From 276471e4d51063e93ee2cabc3b1549ea62be5a43 Mon Sep 17 00:00:00 2001 From: DESY-Z DAQ Setup Computer <ben.brueers@cern.ch> Date: Mon, 9 Oct 2023 12:20:44 +0200 Subject: [PATCH 01/10] parent class for TBMassive20210504* testbenches --- pbv3/CMakeLists.txt | 1 + pbv3/PBv3TBMassive20210504.cpp | 104 +-------------------------- pbv3/PBv3TBMassive20210504.h | 43 +---------- pbv3/PBv3TBMassive20210504Base.cpp | 111 +++++++++++++++++++++++++++++ pbv3/PBv3TBMassive20210504Base.h | 54 ++++++++++++++ pbv3/PBv3TBMassive20210504_EC.cpp | 102 +------------------------- pbv3/PBv3TBMassive20210504_EC.h | 43 +---------- 7 files changed, 175 insertions(+), 283 deletions(-) create mode 100644 pbv3/PBv3TBMassive20210504Base.cpp create mode 100644 pbv3/PBv3TBMassive20210504Base.h diff --git a/pbv3/CMakeLists.txt b/pbv3/CMakeLists.txt index 2be01ceb..6351ee1b 100644 --- a/pbv3/CMakeLists.txt +++ b/pbv3/CMakeLists.txt @@ -42,6 +42,7 @@ target_sources(PBv3 PBv3TBSingle.cpp PBv3TBMassive.cpp PBv3TBMassive20190718.cpp + PBv3TBMassive20210504Base.cpp PBv3TBMassive20210504.cpp PBv3TBMassive20210504_EC.cpp PBv3TBMassive20220329.cpp diff --git a/pbv3/PBv3TBMassive20210504.cpp b/pbv3/PBv3TBMassive20210504.cpp index 33199039..14d1ea3d 100644 --- a/pbv3/PBv3TBMassive20210504.cpp +++ b/pbv3/PBv3TBMassive20210504.cpp @@ -1,109 +1,11 @@ #include "PBv3TBMassive20210504.h" -// AMAC -#include "EndeavourComException.h" -#include "EndeavourRawUIO.h" -#include "EndeavourRawUIOMux.h" - -// I2C -#include "PCA9548ACom.h" - -// ADCs -#include "AD799X.h" -#include "MCP3425.h" - -// IO expanders -#include "TCA9534.h" - // Register test bench #include "PBv3TBRegistry.h" REGISTER_PBV3TB(PBv3TBMassive20210504) -void PBv3TBMassive20210504::setConfiguration(const nlohmann::json &config) { - for (const auto &kv : config.items()) { - if (kv.key() == "zturn_adapter") { - m_zturn_adapter = kv.value(); - } - if (kv.key() == "invertCMDin") { - m_invertCMDin = int(kv.value()); - } - if (kv.key() == "invertCMDout") { - m_invertCMDout = int(kv.value()); - } - } - - PBv3TBMassive::setConfiguration(config); -} - void PBv3TBMassive20210504::initDevices() { + m_pbsel_i2c_port = 0x38; // Common - PBv3TBMassive::initDevices(); - - // Specific - m_adc_pwr = std::make_shared<AD799X>( - 3.3, AD799X::AD7993, - std::make_shared<PCA9548ACom>(0x23, 7, m_i2c_root)); - - m_adc_common = std::make_shared<MCP3425>( - std::make_shared<PCA9548ACom>(0x6A, 1, m_i2c_root)); - - // - // PBs - m_pbsel = std::make_shared<TCA9534>( - std::make_shared<PCA9548ACom>(0x38, 3, m_i2c_root)); - m_pbsel->setIO(0x0); - - std::shared_ptr<UIOCom> pbuio = std::make_shared<UIOCom>(m_pbdev, 0x10000); - - // Mapping for the CMDmux patch panel - bool invertCMDin = m_zturn_adapter; - bool invertCMDout = !m_zturn_adapter; - - if (m_invertCMDin > -1) invertCMDin = m_invertCMDin; - if (m_invertCMDout > -1) invertCMDout = m_invertCMDout; - - m_pbs[0] = std::make_shared<AMACv2>( - 0, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x0, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[1] = std::make_shared<AMACv2>( - 1, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x8, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[2] = std::make_shared<AMACv2>( - 2, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x1, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[3] = std::make_shared<AMACv2>( - 3, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x9, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[4] = std::make_shared<AMACv2>( - 4, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x2, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[5] = std::make_shared<AMACv2>( - 5, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x3, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[6] = std::make_shared<AMACv2>( - 6, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x4, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[7] = std::make_shared<AMACv2>( - 7, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x5, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[8] = std::make_shared<AMACv2>( - 8, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x6, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[9] = std::make_shared<AMACv2>( - 9, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x7, invertCMDin, invertCMDout, m_pbsel, pbuio))); -} - -void PBv3TBMassive20210504::powerTBOn() { - uint32_t curr_val = m_pbsel->read(); - m_pbsel->write((curr_val & 0x0F) | 0x80); - - PBv3TBMassive::powerTBOn(); -} - -void PBv3TBMassive20210504::powerTBOff() { - PBv3TBMassive::powerTBOff(); - - uint32_t curr_val = m_pbsel->read(); - m_pbsel->write((curr_val & 0x0F) | 0x00); -} + PBv3TBMassive20210504Base::initDevices(); + } diff --git a/pbv3/PBv3TBMassive20210504.h b/pbv3/PBv3TBMassive20210504.h index 84d8c7e3..81731d96 100644 --- a/pbv3/PBv3TBMassive20210504.h +++ b/pbv3/PBv3TBMassive20210504.h @@ -1,51 +1,12 @@ #ifndef PBV3TBMASSIVE20210504_H #define PBV3TBMASSIVE20210504_H -#include "PBv3TBMassive.h" - -class PBv3TBMassive20210504 : public PBv3TBMassive { - public: - PBv3TBMassive20210504(std::shared_ptr<PowerSupplyChannel> lv, - std::shared_ptr<PowerSupplyChannel> hv); - PBv3TBMassive20210504(std::shared_ptr<EquipConf> hw); - PBv3TBMassive20210504() = default; - ~PBv3TBMassive20210504() = default; - - //! Configure on JSON object - /** - * Valid keys: - * - `zturn_adapter`: True when using the ZTurn adapter - * - `invertCMDout`: overwrite invertCMDout, set to true for worker 3 when - * using the Zturn adapter - * - `invertCMDin`: overwrite invertCMDin, normally not needed - * - * \param config JSON configuration - */ - virtual void setConfiguration(const nlohmann::json &config); - - /** - * In addtion to PBV3TBMassive powerOn: - * - enable carrier card power - */ - virtual void powerTBOn(); - - /** - * In addtion to PBV3TBMassive powerOff: - * - disable carrier card power - */ - virtual void powerTBOff(); +#include "PBv3TBMassive20210504Base.h" +class PBv3TBMassive20210504 : public PBv3TBMassive20210504Base { protected: //! Initialize devices on the active board virtual void initDevices(); - - private: - //! ZTurn adapter is in use - bool m_zturn_adapter = false; - //! overwrite invertCMDout - int m_invertCMDout = -1; - //! overwrite invertCMDin - int m_invertCMDin = -1; }; #endif // PBV3TBMASSIVE20210504_H diff --git a/pbv3/PBv3TBMassive20210504Base.cpp b/pbv3/PBv3TBMassive20210504Base.cpp new file mode 100644 index 00000000..14210658 --- /dev/null +++ b/pbv3/PBv3TBMassive20210504Base.cpp @@ -0,0 +1,111 @@ +#include "PBv3TBMassive20210504Base.h" + +// AMAC +#include "EndeavourComException.h" +#include "EndeavourRawUIO.h" +#include "EndeavourRawUIOMux.h" + +// I2C +#include "PCA9548ACom.h" + +// ADCs +#include "AD799X.h" +#include "MCP3425.h" + +// IO expanders +#include "TCA9534.h" + +void PBv3TBMassive20210504Base::setConfiguration(const nlohmann::json &config) { + for (const auto &kv : config.items()) { + if (kv.key() == "zturn_adapter") { + m_zturn_adapter = kv.value(); + } + if (kv.key() == "invertCMDin") { + m_invertCMDin = int(kv.value()); + } + if (kv.key() == "invertCMDout") { + m_invertCMDout = int(kv.value()); + } + } + + PBv3TBMassive::setConfiguration(config); +} + +void PBv3TBMassive20210504Base::initDevices(const PBTypeDef::PBType pbType) { + // Common + PBv3TBMassive::initDevices(pbType); + + // Specific + m_adc_pwr = std::make_shared<AD799X>( + 3.3, AD799X::AD7993, + std::make_shared<PCA9548ACom>(0x23, 7, m_i2c_root)); + + m_adc_common = std::make_shared<MCP3425>( + std::make_shared<PCA9548ACom>(0x6A, 1, m_i2c_root)); + + // + // PBs + m_pbsel = std::make_shared<TCA9534>( + std::make_shared<PCA9548ACom>(m_pbsel_i2c_port, 3, m_i2c_root)); + m_pbsel->setIO(0x0); + + std::shared_ptr<UIOCom> pbuio = std::make_shared<UIOCom>(m_pbdev, 0x10000); + + // Mapping for the CMDmux patch panel + bool invertCMDin = m_zturn_adapter; + bool invertCMDout = !m_zturn_adapter; + + // invert CMDin if powerboard is end-cap R0 or end-cap R1 + if (pbType == PBTypeDef::PBType::EC_R0 || + pbType == PBTypeDef::PBType::EC_R1) { + invertCMDin = !invertCMDin; + } + + if (m_invertCMDin > -1) invertCMDin = m_invertCMDin; + if (m_invertCMDout > -1) invertCMDout = m_invertCMDout; + + m_pbs[0] = std::make_shared<AMACv2>( + 0, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( + 0x0, invertCMDin, invertCMDout, m_pbsel, pbuio))); + m_pbs[1] = std::make_shared<AMACv2>( + 1, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( + 0x8, invertCMDin, invertCMDout, m_pbsel, pbuio))); + m_pbs[2] = std::make_shared<AMACv2>( + 2, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( + 0x1, invertCMDin, invertCMDout, m_pbsel, pbuio))); + m_pbs[3] = std::make_shared<AMACv2>( + 3, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( + 0x9, invertCMDin, invertCMDout, m_pbsel, pbuio))); + m_pbs[4] = std::make_shared<AMACv2>( + 4, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( + 0x2, invertCMDin, invertCMDout, m_pbsel, pbuio))); + m_pbs[5] = std::make_shared<AMACv2>( + 5, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( + 0x3, invertCMDin, invertCMDout, m_pbsel, pbuio))); + m_pbs[6] = std::make_shared<AMACv2>( + 6, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( + 0x4, invertCMDin, invertCMDout, m_pbsel, pbuio))); + m_pbs[7] = std::make_shared<AMACv2>( + 7, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( + 0x5, invertCMDin, invertCMDout, m_pbsel, pbuio))); + m_pbs[8] = std::make_shared<AMACv2>( + 8, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( + 0x6, invertCMDin, invertCMDout, m_pbsel, pbuio))); + m_pbs[9] = std::make_shared<AMACv2>( + 9, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( + 0x7, invertCMDin, invertCMDout, m_pbsel, pbuio))); +} + +void PBv3TBMassive20210504Base::powerTBOn() { + uint32_t curr_val = m_pbsel->read(); + m_pbsel->write((curr_val & 0x0F) | 0x80); + + PBv3TBMassive::powerTBOn(); +} + +void PBv3TBMassive20210504Base::powerTBOff() { + PBv3TBMassive::powerTBOff(); + + uint32_t curr_val = m_pbsel->read(); + m_pbsel->write((curr_val & 0x0F) | 0x00); +} diff --git a/pbv3/PBv3TBMassive20210504Base.h b/pbv3/PBv3TBMassive20210504Base.h new file mode 100644 index 00000000..f6c82412 --- /dev/null +++ b/pbv3/PBv3TBMassive20210504Base.h @@ -0,0 +1,54 @@ +#ifndef PBV3TBMASSIVE20210504BASE_H +#define PBV3TBMASSIVE20210504BASE_H + +#include "PBv3TBMassive.h" + +class PBv3TBMassive20210504Base : public PBv3TBMassive { + public: + PBv3TBMassive20210504Base(std::shared_ptr<PowerSupplyChannel> lv, + std::shared_ptr<PowerSupplyChannel> hv); + PBv3TBMassive20210504Base(std::shared_ptr<EquipConf> hw); + PBv3TBMassive20210504Base() = default; + ~PBv3TBMassive20210504Base() = default; + + //! Configure on JSON object + /** + * Valid keys: + * - `zturn_adapter`: True when using the ZTurn adapter + * - `invertCMDout`: overwrite invertCMDout, set to true for worker 3 when + * using the Zturn adapter + * - `invertCMDin`: overwrite invertCMDin, normally not needed + * + * \param config JSON configuration + */ + virtual void setConfiguration(const nlohmann::json &config); + + /** + * In addtion to PBV3TBMassive powerOn: + * - enable carrier card power + */ + virtual void powerTBOn(); + + /** + * In addtion to PBV3TBMassive powerOff: + * - disable carrier card power + */ + virtual void powerTBOff(); + + protected: + //! Initialize devices on the active board + virtual void initDevices( + const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); + //! I2C port for pb-selector mux + uint8_t m_pbsel_i2c_port = 0; + + private: + //! ZTurn adapter is in use + bool m_zturn_adapter = false; + //! overwrite invertCMDout + int m_invertCMDout = -1; + //! overwrite invertCMDin + int m_invertCMDin = -1; +}; + +#endif // PBV3TBMASSIVE20210504BASE_H diff --git a/pbv3/PBv3TBMassive20210504_EC.cpp b/pbv3/PBv3TBMassive20210504_EC.cpp index 381c1cea..bc9e60d4 100644 --- a/pbv3/PBv3TBMassive20210504_EC.cpp +++ b/pbv3/PBv3TBMassive20210504_EC.cpp @@ -1,109 +1,11 @@ #include "PBv3TBMassive20210504_EC.h" -// AMAC -#include "EndeavourComException.h" -#include "EndeavourRawUIO.h" -#include "EndeavourRawUIOMux.h" - -// I2C -#include "PCA9548ACom.h" - -// ADCs -#include "AD799X.h" -#include "MCP3425.h" - -// IO expanders -#include "TCA9534.h" - // Register test bench #include "PBv3TBRegistry.h" REGISTER_PBV3TB(PBv3TBMassive20210504_EC) -void PBv3TBMassive20210504_EC::setConfiguration(const nlohmann::json &config) { - for (const auto &kv : config.items()) { - if (kv.key() == "zturn_adapter") { - m_zturn_adapter = kv.value(); - } - if (kv.key() == "invertCMDin") { - m_invertCMDin = int(kv.value()); - } - if (kv.key() == "invertCMDout") { - m_invertCMDout = int(kv.value()); - } - } - - PBv3TBMassive::setConfiguration(config); -} - void PBv3TBMassive20210504_EC::initDevices() { + m_pbsel_i2c_port = 0x20; // Common - PBv3TBMassive::initDevices(); - - // Specific - m_adc_pwr = std::make_shared<AD799X>( - 3.3, AD799X::AD7993, - std::make_shared<PCA9548ACom>(0x23, 7, m_i2c_root)); - - m_adc_common = std::make_shared<MCP3425>( - std::make_shared<PCA9548ACom>(0x6A, 1, m_i2c_root)); - - // - // PBs - m_pbsel = std::make_shared<TCA9534>(std::make_shared<PCA9548ACom>( - 0x20, 3, m_i2c_root)); // EC version uses 0x20 instead of 0x38 - m_pbsel->setIO(0x0); - - std::shared_ptr<UIOCom> pbuio = std::make_shared<UIOCom>(m_pbdev, 0x10000); - - // Mapping for the CMDmux patch panel - bool invertCMDin = m_zturn_adapter; - bool invertCMDout = !m_zturn_adapter; - - if (m_invertCMDin > -1) invertCMDin = m_invertCMDin; - if (m_invertCMDout > -1) invertCMDout = m_invertCMDout; - - m_pbs[0] = std::make_shared<AMACv2>( - 0, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x0, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[1] = std::make_shared<AMACv2>( - 1, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x8, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[2] = std::make_shared<AMACv2>( - 2, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x1, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[3] = std::make_shared<AMACv2>( - 3, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x9, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[4] = std::make_shared<AMACv2>( - 4, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x2, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[5] = std::make_shared<AMACv2>( - 5, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x3, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[6] = std::make_shared<AMACv2>( - 6, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x4, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[7] = std::make_shared<AMACv2>( - 7, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x5, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[8] = std::make_shared<AMACv2>( - 8, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x6, invertCMDin, invertCMDout, m_pbsel, pbuio))); - m_pbs[9] = std::make_shared<AMACv2>( - 9, std::unique_ptr<EndeavourRaw>(new EndeavourRawUIOMux( - 0x7, invertCMDin, invertCMDout, m_pbsel, pbuio))); -} - -void PBv3TBMassive20210504_EC::powerTBOn() { - uint32_t curr_val = m_pbsel->read(); - m_pbsel->write((curr_val & 0x0F) | 0x80); - - PBv3TBMassive::powerTBOn(); -} - -void PBv3TBMassive20210504_EC::powerTBOff() { - PBv3TBMassive::powerTBOff(); - - uint32_t curr_val = m_pbsel->read(); - m_pbsel->write((curr_val & 0x0F) | 0x00); + PBv3TBMassive20210504Base::initDevices(); } diff --git a/pbv3/PBv3TBMassive20210504_EC.h b/pbv3/PBv3TBMassive20210504_EC.h index 5c887bf0..02ceff85 100644 --- a/pbv3/PBv3TBMassive20210504_EC.h +++ b/pbv3/PBv3TBMassive20210504_EC.h @@ -1,51 +1,12 @@ #ifndef PBV3TBMASSIVE20210504_EC_H #define PBV3TBMASSIVE20210504_EC_H -#include "PBv3TBMassive.h" - -class PBv3TBMassive20210504_EC : public PBv3TBMassive { - public: - PBv3TBMassive20210504_EC(std::shared_ptr<PowerSupplyChannel> lv, - std::shared_ptr<PowerSupplyChannel> hv); - PBv3TBMassive20210504_EC(std::shared_ptr<EquipConf> hw); - PBv3TBMassive20210504_EC() = default; - ~PBv3TBMassive20210504_EC() = default; - - //! Configure on JSON object - /** - * Valid keys: - * - `zturn_adapter`: True when using the ZTurn adapter - * - `invertCMDout`: overwrite invertCMDout, set to true for worker 3 when - * using the Zturn adapter - * - `invertCMDin`: overwrite invertCMDin, normally not needed - * - * \param config JSON configuration - */ - virtual void setConfiguration(const nlohmann::json &config); - - /** - * In addtion to PBV3TBMassive powerOn: - * - enable carrier card power - */ - virtual void powerTBOn(); - - /** - * In addtion to PBV3TBMassive powerOff: - * - disable carrier card power - */ - virtual void powerTBOff(); +#include "PBv3TBMassive20210504Base.h" +class PBv3TBMassive20210504_EC : public PBv3TBMassive20210504Base { protected: //! Initialize devices on the active board virtual void initDevices(); - - private: - //! ZTurn adapter is in use - bool m_zturn_adapter = false; - //! overwrite invertCMDout - int m_invertCMDout = -1; - //! overwrite invertCMDin - int m_invertCMDin = -1; }; #endif // PBV3TBMASSIVE20210504_EC_H -- GitLab From e5e342d0bbc04a71ba9fc270ff1d290a57bcb73d Mon Sep 17 00:00:00 2001 From: Ben Bruers <ben.brueers@cern.ch> Date: Mon, 9 Oct 2023 13:53:00 +0200 Subject: [PATCH 02/10] Fix formatting --- pbv3/PBv3TBMassive20210504.cpp | 2 +- pbv3/PBv3TBMassive20210504Base.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pbv3/PBv3TBMassive20210504.cpp b/pbv3/PBv3TBMassive20210504.cpp index 14d1ea3d..13cec74e 100644 --- a/pbv3/PBv3TBMassive20210504.cpp +++ b/pbv3/PBv3TBMassive20210504.cpp @@ -8,4 +8,4 @@ void PBv3TBMassive20210504::initDevices() { m_pbsel_i2c_port = 0x38; // Common PBv3TBMassive20210504Base::initDevices(); - } +} diff --git a/pbv3/PBv3TBMassive20210504Base.h b/pbv3/PBv3TBMassive20210504Base.h index f6c82412..9b8ad41c 100644 --- a/pbv3/PBv3TBMassive20210504Base.h +++ b/pbv3/PBv3TBMassive20210504Base.h @@ -6,7 +6,7 @@ class PBv3TBMassive20210504Base : public PBv3TBMassive { public: PBv3TBMassive20210504Base(std::shared_ptr<PowerSupplyChannel> lv, - std::shared_ptr<PowerSupplyChannel> hv); + std::shared_ptr<PowerSupplyChannel> hv); PBv3TBMassive20210504Base(std::shared_ptr<EquipConf> hw); PBv3TBMassive20210504Base() = default; ~PBv3TBMassive20210504Base() = default; -- GitLab From 4ca69cc9109680a52239bbbb90d57843bc1d408a Mon Sep 17 00:00:00 2001 From: Ben Bruers <ben.brueers@cern.ch> Date: Mon, 9 Oct 2023 13:58:51 +0200 Subject: [PATCH 03/10] remove change that will come later --- pbv3/PBv3TBMassive20210504Base.cpp | 10 ++-------- pbv3/PBv3TBMassive20210504Base.h | 3 +-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/pbv3/PBv3TBMassive20210504Base.cpp b/pbv3/PBv3TBMassive20210504Base.cpp index 14210658..6157d93a 100644 --- a/pbv3/PBv3TBMassive20210504Base.cpp +++ b/pbv3/PBv3TBMassive20210504Base.cpp @@ -31,9 +31,9 @@ void PBv3TBMassive20210504Base::setConfiguration(const nlohmann::json &config) { PBv3TBMassive::setConfiguration(config); } -void PBv3TBMassive20210504Base::initDevices(const PBTypeDef::PBType pbType) { +void PBv3TBMassive20210504Base::initDevices() { // Common - PBv3TBMassive::initDevices(pbType); + PBv3TBMassive::initDevices(); // Specific m_adc_pwr = std::make_shared<AD799X>( @@ -55,12 +55,6 @@ void PBv3TBMassive20210504Base::initDevices(const PBTypeDef::PBType pbType) { bool invertCMDin = m_zturn_adapter; bool invertCMDout = !m_zturn_adapter; - // invert CMDin if powerboard is end-cap R0 or end-cap R1 - if (pbType == PBTypeDef::PBType::EC_R0 || - pbType == PBTypeDef::PBType::EC_R1) { - invertCMDin = !invertCMDin; - } - if (m_invertCMDin > -1) invertCMDin = m_invertCMDin; if (m_invertCMDout > -1) invertCMDout = m_invertCMDout; diff --git a/pbv3/PBv3TBMassive20210504Base.h b/pbv3/PBv3TBMassive20210504Base.h index 9b8ad41c..2c5f7276 100644 --- a/pbv3/PBv3TBMassive20210504Base.h +++ b/pbv3/PBv3TBMassive20210504Base.h @@ -37,8 +37,7 @@ class PBv3TBMassive20210504Base : public PBv3TBMassive { protected: //! Initialize devices on the active board - virtual void initDevices( - const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); + virtual void initDevices(); //! I2C port for pb-selector mux uint8_t m_pbsel_i2c_port = 0; -- GitLab From 84837724a1190783b3acbe95621130d75bed0c6b Mon Sep 17 00:00:00 2001 From: Ben Bruers <ben.brueers@cern.ch> Date: Mon, 9 Oct 2023 14:04:31 +0200 Subject: [PATCH 04/10] make change I wanted --- pbv3/PBv3TBMassive20210504.cpp | 4 ++-- pbv3/PBv3TBMassive20210504.h | 3 ++- pbv3/PBv3TBMassive20210504Base.cpp | 10 ++++++++-- pbv3/PBv3TBMassive20210504Base.h | 3 ++- pbv3/PBv3TBMassive20210504_EC.cpp | 4 ++-- pbv3/PBv3TBMassive20210504_EC.h | 3 ++- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pbv3/PBv3TBMassive20210504.cpp b/pbv3/PBv3TBMassive20210504.cpp index 13cec74e..21b7fdd2 100644 --- a/pbv3/PBv3TBMassive20210504.cpp +++ b/pbv3/PBv3TBMassive20210504.cpp @@ -4,8 +4,8 @@ #include "PBv3TBRegistry.h" REGISTER_PBV3TB(PBv3TBMassive20210504) -void PBv3TBMassive20210504::initDevices() { +void PBv3TBMassive20210504::initDevices(const PBTypeDef::PBType pbType) { m_pbsel_i2c_port = 0x38; // Common - PBv3TBMassive20210504Base::initDevices(); + PBv3TBMassive20210504Base::initDevices(pbType); } diff --git a/pbv3/PBv3TBMassive20210504.h b/pbv3/PBv3TBMassive20210504.h index 81731d96..f13a352f 100644 --- a/pbv3/PBv3TBMassive20210504.h +++ b/pbv3/PBv3TBMassive20210504.h @@ -6,7 +6,8 @@ class PBv3TBMassive20210504 : public PBv3TBMassive20210504Base { protected: //! Initialize devices on the active board - virtual void initDevices(); + virtual void initDevices( + const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); }; #endif // PBV3TBMASSIVE20210504_H diff --git a/pbv3/PBv3TBMassive20210504Base.cpp b/pbv3/PBv3TBMassive20210504Base.cpp index 6157d93a..14210658 100644 --- a/pbv3/PBv3TBMassive20210504Base.cpp +++ b/pbv3/PBv3TBMassive20210504Base.cpp @@ -31,9 +31,9 @@ void PBv3TBMassive20210504Base::setConfiguration(const nlohmann::json &config) { PBv3TBMassive::setConfiguration(config); } -void PBv3TBMassive20210504Base::initDevices() { +void PBv3TBMassive20210504Base::initDevices(const PBTypeDef::PBType pbType) { // Common - PBv3TBMassive::initDevices(); + PBv3TBMassive::initDevices(pbType); // Specific m_adc_pwr = std::make_shared<AD799X>( @@ -55,6 +55,12 @@ void PBv3TBMassive20210504Base::initDevices() { bool invertCMDin = m_zturn_adapter; bool invertCMDout = !m_zturn_adapter; + // invert CMDin if powerboard is end-cap R0 or end-cap R1 + if (pbType == PBTypeDef::PBType::EC_R0 || + pbType == PBTypeDef::PBType::EC_R1) { + invertCMDin = !invertCMDin; + } + if (m_invertCMDin > -1) invertCMDin = m_invertCMDin; if (m_invertCMDout > -1) invertCMDout = m_invertCMDout; diff --git a/pbv3/PBv3TBMassive20210504Base.h b/pbv3/PBv3TBMassive20210504Base.h index 2c5f7276..9b8ad41c 100644 --- a/pbv3/PBv3TBMassive20210504Base.h +++ b/pbv3/PBv3TBMassive20210504Base.h @@ -37,7 +37,8 @@ class PBv3TBMassive20210504Base : public PBv3TBMassive { protected: //! Initialize devices on the active board - virtual void initDevices(); + virtual void initDevices( + const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); //! I2C port for pb-selector mux uint8_t m_pbsel_i2c_port = 0; diff --git a/pbv3/PBv3TBMassive20210504_EC.cpp b/pbv3/PBv3TBMassive20210504_EC.cpp index bc9e60d4..c7fa3e35 100644 --- a/pbv3/PBv3TBMassive20210504_EC.cpp +++ b/pbv3/PBv3TBMassive20210504_EC.cpp @@ -4,8 +4,8 @@ #include "PBv3TBRegistry.h" REGISTER_PBV3TB(PBv3TBMassive20210504_EC) -void PBv3TBMassive20210504_EC::initDevices() { +void PBv3TBMassive20210504_EC::initDevices(const PBTypeDef::PBType pbType) { m_pbsel_i2c_port = 0x20; // Common - PBv3TBMassive20210504Base::initDevices(); + PBv3TBMassive20210504Base::initDevices(pbType); } diff --git a/pbv3/PBv3TBMassive20210504_EC.h b/pbv3/PBv3TBMassive20210504_EC.h index 02ceff85..1ffad645 100644 --- a/pbv3/PBv3TBMassive20210504_EC.h +++ b/pbv3/PBv3TBMassive20210504_EC.h @@ -6,7 +6,8 @@ class PBv3TBMassive20210504_EC : public PBv3TBMassive20210504Base { protected: //! Initialize devices on the active board - virtual void initDevices(); + virtual void initDevices( + const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); }; #endif // PBV3TBMASSIVE20210504_EC_H -- GitLab From fa21f2194c1895473e31d37be390d091c359363a Mon Sep 17 00:00:00 2001 From: DESY-Z DAQ Setup Computer <ben.brueers@cern.ch> Date: Mon, 9 Oct 2023 11:03:38 +0200 Subject: [PATCH 05/10] Move pbType to testbench initialisation --- .gitignore | 5 ++++- CMakeLists.txt | 1 + pbv3/PBv3TB.h | 2 +- pbv3/PBv3TBConf.cpp | 5 +++-- pbv3/PBv3TBConf.h | 2 +- pbv3/PBv3TBMassive.cpp | 7 ++++--- pbv3/PBv3TBMassive.h | 4 ++-- pbv3/PBv3TBMassive20190718.cpp | 4 ++-- pbv3/PBv3TBMassive20190718.h | 2 +- pbv3/PBv3TBMassive20220329.cpp | 7 ++++++- pbv3/PBv3TBMassive20220329.h | 2 +- pbv3/PBv3TBModule.cpp | 3 ++- pbv3/PBv3TBModule.h | 2 +- pbv3/PBv3TBSingle.cpp | 2 +- pbv3/PBv3TBSingle.h | 2 +- pbv3/tools/pbv3_mass_test.cpp | 4 +--- 16 files changed, 32 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 642b7fe1..f87735f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ *#* -*~ \ No newline at end of file +*~ +build/* +*json +*tar* \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 8189df51..5b9218af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,7 @@ else() endif() set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_FLAGS -Wno-psabi) # labRemote dependency diff --git a/pbv3/PBv3TB.h b/pbv3/PBv3TB.h index a67351f4..c0f4f0bc 100644 --- a/pbv3/PBv3TB.h +++ b/pbv3/PBv3TB.h @@ -68,7 +68,7 @@ class PBv3TB { * with the testbench. The state should not be reset to allow reading from * an already active testbench. */ - virtual void init() = 0; + virtual void init(const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL) = 0; //! Power on the testbench /** diff --git a/pbv3/PBv3TBConf.cpp b/pbv3/PBv3TBConf.cpp index ae8ba5e5..b2a580ca 100644 --- a/pbv3/PBv3TBConf.cpp +++ b/pbv3/PBv3TBConf.cpp @@ -6,6 +6,7 @@ #include <string> #include "PBv3TBRegistry.h" +#include "PBTypeDef.h" //////////////////// // Configuration @@ -55,7 +56,7 @@ json PBv3TBConf::getPBv3TBConf(const std::string &label) { // General private //////////////////// -std::shared_ptr<PBv3TB> PBv3TBConf::getPBv3TB(const std::string &label) { +std::shared_ptr<PBv3TB> PBv3TBConf::getPBv3TB(const std::string &label, const PBTypeDef::PBType pbType) { // first check if an object with the same label/type is already available // (was already instantiated) if (m_listPBv3TB.find(label) != m_listPBv3TB.end()) @@ -87,7 +88,7 @@ std::shared_ptr<PBv3TB> PBv3TBConf::getPBv3TB(const std::string &label) { tb->setHVPS(hv); // initialize it - tb->init(); + tb->init(pbType); return tb; } diff --git a/pbv3/PBv3TBConf.h b/pbv3/PBv3TBConf.h index 425c7021..cdc24cb5 100644 --- a/pbv3/PBv3TBConf.h +++ b/pbv3/PBv3TBConf.h @@ -76,7 +76,7 @@ class PBv3TBConf { * * \param name label for the hardware object in JSON configuration file */ - std::shared_ptr<PBv3TB> getPBv3TB(const std::string &name); + std::shared_ptr<PBv3TB> getPBv3TB(const std::string &name, const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); /** @} */ diff --git a/pbv3/PBv3TBMassive.cpp b/pbv3/PBv3TBMassive.cpp index d03c572f..aa64b31a 100644 --- a/pbv3/PBv3TBMassive.cpp +++ b/pbv3/PBv3TBMassive.cpp @@ -49,12 +49,13 @@ void PBv3TBMassive::setConfiguration(const nlohmann::json &config) { PBv3TB::setConfiguration(config); } -void PBv3TBMassive::init() { - initDevices(); +void PBv3TBMassive::init(const PBTypeDef::PBType pbType) { + initDevices(pbType); loadCalibrations(); + setPBPanelType(pbType); } -void PBv3TBMassive::initDevices() { +void PBv3TBMassive::initDevices(const PBTypeDef::PBType pbType) { // // Create the I2C mappings diff --git a/pbv3/PBv3TBMassive.h b/pbv3/PBv3TBMassive.h index 087f56f9..ecf29f53 100644 --- a/pbv3/PBv3TBMassive.h +++ b/pbv3/PBv3TBMassive.h @@ -119,7 +119,7 @@ class PBv3TBMassive : public PBv3TB { /** * Calls `initDevices` and `loadCalibrations`. */ - virtual void init(); + virtual void init(PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); /** * Disable carrier card multiplexers if a carrier card is @@ -196,7 +196,7 @@ class PBv3TBMassive : public PBv3TB { * and then call this implenentation to handle * the common chips. */ - virtual void initDevices(); + virtual void initDevices(const PBTypeDef::PBType pbType); //! Applies calibrations to devices virtual void loadCalibrations(); diff --git a/pbv3/PBv3TBMassive20190718.cpp b/pbv3/PBv3TBMassive20190718.cpp index 944c1bb4..8eb7b802 100644 --- a/pbv3/PBv3TBMassive20190718.cpp +++ b/pbv3/PBv3TBMassive20190718.cpp @@ -19,9 +19,9 @@ #include "PBv3TBRegistry.h" REGISTER_PBV3TB(PBv3TBMassive20190718) -void PBv3TBMassive20190718::initDevices() { +void PBv3TBMassive20190718::initDevices(const PBTypeDef::PBType pbType) { // Common - PBv3TBMassive::initDevices(); + PBv3TBMassive::initDevices(pbType); // Specific m_adc_pwr = std::make_shared<AD799X>( diff --git a/pbv3/PBv3TBMassive20190718.h b/pbv3/PBv3TBMassive20190718.h index 387a3eda..cfd4d9f3 100644 --- a/pbv3/PBv3TBMassive20190718.h +++ b/pbv3/PBv3TBMassive20190718.h @@ -13,7 +13,7 @@ class PBv3TBMassive20190718 : public PBv3TBMassive { protected: //! Initialize devices on the active board - void initDevices(); + void initDevices(const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); }; #endif // PBV3TBMASSIVE20190718_H diff --git a/pbv3/PBv3TBMassive20220329.cpp b/pbv3/PBv3TBMassive20220329.cpp index de59add7..e765e54d 100644 --- a/pbv3/PBv3TBMassive20220329.cpp +++ b/pbv3/PBv3TBMassive20220329.cpp @@ -53,7 +53,7 @@ void PBv3TBMassive20220329::setConfiguration(const nlohmann::json &config) { PBv3TBMassive::setConfiguration(config); } -void PBv3TBMassive20220329::initDevices() { +void PBv3TBMassive20220329::initDevices(const PBTypeDef::PBType pbType) { // Multiplexers m_i2c_root = std::make_shared<I2CDevCom>(0x70, m_i2cdev); @@ -136,6 +136,11 @@ void PBv3TBMassive20220329::initDevices() { bool invertCMDin = m_zturn_adapter; bool invertCMDout = !m_zturn_adapter; + // invert CMDin if powerboard is end-cap R0 or end-cap R1 + if(pbType == PBTypeDef::PBType::EC_R0 || pbType == PBTypeDef::PBType::EC_R1){ + invertCMDin = !invertCMDin; + } + if (m_invertCMDin > -1) invertCMDin = m_invertCMDin; if (m_invertCMDout > -1) invertCMDout = m_invertCMDout; diff --git a/pbv3/PBv3TBMassive20220329.h b/pbv3/PBv3TBMassive20220329.h index 0b878ac4..86736497 100644 --- a/pbv3/PBv3TBMassive20220329.h +++ b/pbv3/PBv3TBMassive20220329.h @@ -46,7 +46,7 @@ class PBv3TBMassive20220329 : public PBv3TBMassive { protected: //! Initialize devices on the active board - virtual void initDevices(); + virtual void initDevices(const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); private: //! ZTurn adapter is in use diff --git a/pbv3/PBv3TBModule.cpp b/pbv3/PBv3TBModule.cpp index 69d64bd9..d88a1a6b 100644 --- a/pbv3/PBv3TBModule.cpp +++ b/pbv3/PBv3TBModule.cpp @@ -36,7 +36,7 @@ void PBv3TBModule::setConfiguration(const nlohmann::json &config) { PBv3TB::setConfiguration(config); } -void PBv3TBModule::init() { +void PBv3TBModule::init(const PBTypeDef::PBType pbType) { // PB com m_com = std::make_shared<ITSDAQCom>(m_ip, m_port); for (uint32_t i = 0; i < m_pb_commid.size(); i++) { @@ -53,6 +53,7 @@ void PBv3TBModule::init() { void PBv3TBModule::setOFin(uint8_t pbNum, bool value) { logger(logWARNING) << "OFin not implemented on module yet."; + return true; } double PBv3TBModule::getVin() { diff --git a/pbv3/PBv3TBModule.h b/pbv3/PBv3TBModule.h index 310d6743..82426c3c 100644 --- a/pbv3/PBv3TBModule.h +++ b/pbv3/PBv3TBModule.h @@ -27,7 +27,7 @@ class PBv3TBModule : public PBv3TB { * Initializes I2C communication with CAL DAC and creates the * AMACv2 object assuming padid 0. */ - virtual void init(); + virtual void init(const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); std::shared_ptr<AMACv2> getPB(uint8_t pb); diff --git a/pbv3/PBv3TBSingle.cpp b/pbv3/PBv3TBSingle.cpp index 9859da68..527eb9b2 100644 --- a/pbv3/PBv3TBSingle.cpp +++ b/pbv3/PBv3TBSingle.cpp @@ -27,7 +27,7 @@ void PBv3TBSingle::setConfiguration(const nlohmann::json &config) { PBv3TB::setConfiguration(config); } -void PBv3TBSingle::init() { +void PBv3TBSingle::init(const PBTypeDef::PBType pbType) { if (!m_bkdev.empty()) initLoad(); initPB(); } diff --git a/pbv3/PBv3TBSingle.h b/pbv3/PBv3TBSingle.h index ee7c9167..46c3659c 100644 --- a/pbv3/PBv3TBSingle.h +++ b/pbv3/PBv3TBSingle.h @@ -39,7 +39,7 @@ class PBv3TBSingle : public PBv3TB { * * Calls `initLoad and initPB` */ - virtual void init(); + virtual void init(const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); std::shared_ptr<AMACv2> getPB(uint8_t pbNum); diff --git a/pbv3/tools/pbv3_mass_test.cpp b/pbv3/tools/pbv3_mass_test.cpp index ffd27727..2f475c25 100644 --- a/pbv3/tools/pbv3_mass_test.cpp +++ b/pbv3/tools/pbv3_mass_test.cpp @@ -304,6 +304,7 @@ int main(int argc, char *argv[]) { // // Create and initialize the testbench + // also set PBType PBv3TBConf factory_pbv3tb(equipConfigFile); // Check if institution is provided if (institution == "") { @@ -349,9 +350,6 @@ int main(int argc, char *argv[]) { std::vector<PBv3QCFlow> pbs; std::map<int, PBv3QCFlow> pbs_secondary_map; for (uint32_t i = 0; i < pbNum.size(); i++) { - // get PBType, this type specification is needed for R3 - tb->setPBPanelType(type); - PBv3QCFlow pb(pbNum[i], doHV, hbipc); pb.setSerial(serial[i]); pbs.push_back(pb); -- GitLab From d5c8b89f0f4f1347e842ca09ca6d362cb392f30b Mon Sep 17 00:00:00 2001 From: Ben Bruers <ben.brueers@cern.ch> Date: Mon, 9 Oct 2023 11:05:52 +0200 Subject: [PATCH 06/10] Clang-format --- pbv3/PBv3TB.h | 3 ++- pbv3/PBv3TBConf.cpp | 5 +++-- pbv3/PBv3TBConf.h | 4 +++- pbv3/PBv3TBMassive20190718.h | 3 ++- pbv3/PBv3TBMassive20220329.cpp | 3 ++- pbv3/PBv3TBMassive20220329.h | 3 ++- pbv3/PBv3TBModule.h | 3 ++- pbv3/PBv3TBSingle.h | 3 ++- 8 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pbv3/PBv3TB.h b/pbv3/PBv3TB.h index c0f4f0bc..67dc023a 100644 --- a/pbv3/PBv3TB.h +++ b/pbv3/PBv3TB.h @@ -68,7 +68,8 @@ class PBv3TB { * with the testbench. The state should not be reset to allow reading from * an already active testbench. */ - virtual void init(const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL) = 0; + virtual void init( + const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL) = 0; //! Power on the testbench /** diff --git a/pbv3/PBv3TBConf.cpp b/pbv3/PBv3TBConf.cpp index b2a580ca..e5d75188 100644 --- a/pbv3/PBv3TBConf.cpp +++ b/pbv3/PBv3TBConf.cpp @@ -5,8 +5,8 @@ #include <iostream> #include <string> -#include "PBv3TBRegistry.h" #include "PBTypeDef.h" +#include "PBv3TBRegistry.h" //////////////////// // Configuration @@ -56,7 +56,8 @@ json PBv3TBConf::getPBv3TBConf(const std::string &label) { // General private //////////////////// -std::shared_ptr<PBv3TB> PBv3TBConf::getPBv3TB(const std::string &label, const PBTypeDef::PBType pbType) { +std::shared_ptr<PBv3TB> PBv3TBConf::getPBv3TB(const std::string &label, + const PBTypeDef::PBType pbType) { // first check if an object with the same label/type is already available // (was already instantiated) if (m_listPBv3TB.find(label) != m_listPBv3TB.end()) diff --git a/pbv3/PBv3TBConf.h b/pbv3/PBv3TBConf.h index cdc24cb5..354a4141 100644 --- a/pbv3/PBv3TBConf.h +++ b/pbv3/PBv3TBConf.h @@ -76,7 +76,9 @@ class PBv3TBConf { * * \param name label for the hardware object in JSON configuration file */ - std::shared_ptr<PBv3TB> getPBv3TB(const std::string &name, const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); + std::shared_ptr<PBv3TB> getPBv3TB( + const std::string &name, + const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); /** @} */ diff --git a/pbv3/PBv3TBMassive20190718.h b/pbv3/PBv3TBMassive20190718.h index cfd4d9f3..e624f146 100644 --- a/pbv3/PBv3TBMassive20190718.h +++ b/pbv3/PBv3TBMassive20190718.h @@ -13,7 +13,8 @@ class PBv3TBMassive20190718 : public PBv3TBMassive { protected: //! Initialize devices on the active board - void initDevices(const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); + void initDevices( + const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); }; #endif // PBV3TBMASSIVE20190718_H diff --git a/pbv3/PBv3TBMassive20220329.cpp b/pbv3/PBv3TBMassive20220329.cpp index e765e54d..9ecab3f1 100644 --- a/pbv3/PBv3TBMassive20220329.cpp +++ b/pbv3/PBv3TBMassive20220329.cpp @@ -137,7 +137,8 @@ void PBv3TBMassive20220329::initDevices(const PBTypeDef::PBType pbType) { bool invertCMDout = !m_zturn_adapter; // invert CMDin if powerboard is end-cap R0 or end-cap R1 - if(pbType == PBTypeDef::PBType::EC_R0 || pbType == PBTypeDef::PBType::EC_R1){ + if (pbType == PBTypeDef::PBType::EC_R0 || + pbType == PBTypeDef::PBType::EC_R1) { invertCMDin = !invertCMDin; } diff --git a/pbv3/PBv3TBMassive20220329.h b/pbv3/PBv3TBMassive20220329.h index 86736497..0d7ec998 100644 --- a/pbv3/PBv3TBMassive20220329.h +++ b/pbv3/PBv3TBMassive20220329.h @@ -46,7 +46,8 @@ class PBv3TBMassive20220329 : public PBv3TBMassive { protected: //! Initialize devices on the active board - virtual void initDevices(const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); + virtual void initDevices( + const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); private: //! ZTurn adapter is in use diff --git a/pbv3/PBv3TBModule.h b/pbv3/PBv3TBModule.h index 82426c3c..233469b4 100644 --- a/pbv3/PBv3TBModule.h +++ b/pbv3/PBv3TBModule.h @@ -27,7 +27,8 @@ class PBv3TBModule : public PBv3TB { * Initializes I2C communication with CAL DAC and creates the * AMACv2 object assuming padid 0. */ - virtual void init(const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); + virtual void init( + const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); std::shared_ptr<AMACv2> getPB(uint8_t pb); diff --git a/pbv3/PBv3TBSingle.h b/pbv3/PBv3TBSingle.h index 46c3659c..45b06ea4 100644 --- a/pbv3/PBv3TBSingle.h +++ b/pbv3/PBv3TBSingle.h @@ -39,7 +39,8 @@ class PBv3TBSingle : public PBv3TB { * * Calls `initLoad and initPB` */ - virtual void init(const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); + virtual void init( + const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); std::shared_ptr<AMACv2> getPB(uint8_t pbNum); -- GitLab From 3b1bd08dea74d57d35e84748d587899cf622562d Mon Sep 17 00:00:00 2001 From: DESY-Z DAQ Setup Computer <ben.brueers@cern.ch> Date: Mon, 9 Oct 2023 11:59:42 +0200 Subject: [PATCH 07/10] make setPBpanelType private and add type to testbench init --- pbv3/PBv3TB.h | 5 ++--- pbv3/tools/pbv3_basic_test.cpp | 7 ++----- pbv3/tools/pbv3_mass_test.cpp | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/pbv3/PBv3TB.h b/pbv3/PBv3TB.h index 67dc023a..ee100c5c 100644 --- a/pbv3/PBv3TB.h +++ b/pbv3/PBv3TB.h @@ -201,9 +201,6 @@ class PBv3TB { //! \brief Get PB pbNum HV output current virtual double getHVoutCurrent(uint8_t pbNum) = 0; - //! \brief Set the PB type - void setPBPanelType(PBTypeDef::PBType type); - //! \brief Get PB type PBTypeDef::PBType getPBPanelType(); @@ -216,6 +213,8 @@ class PBv3TB { //! \brief Set the CAL DAC device void setCalDAC(std::shared_ptr<DACDevice> CalDAC); + //! \brief Set the PB type + void setPBPanelType(PBTypeDef::PBType type); private: std::shared_ptr<DACDevice> m_CalDAC; diff --git a/pbv3/tools/pbv3_basic_test.cpp b/pbv3/tools/pbv3_basic_test.cpp index 6ec46a9b..f9e263c0 100644 --- a/pbv3/tools/pbv3_basic_test.cpp +++ b/pbv3/tools/pbv3_basic_test.cpp @@ -136,14 +136,11 @@ int main(int argc, char *argv[]) { logger(logDEBUG) << " outDir: " << outDir; // - // Create and initialize the testbench + // Create and initialize the testbench and set PB panel type PBv3TBConf factory_pbv3tb(equipConfigFile); - std::shared_ptr<PBv3TB> tb = factory_pbv3tb.getPBv3TB("default"); + std::shared_ptr<PBv3TB> tb = factory_pbv3tb.getPBv3TB("default", type); if (tb == nullptr) return 1; - // Set PB panel type - tb->setPBPanelType(type); - // Power up the testbench tb->powerTBOn(); diff --git a/pbv3/tools/pbv3_mass_test.cpp b/pbv3/tools/pbv3_mass_test.cpp index 2f475c25..7e803845 100644 --- a/pbv3/tools/pbv3_mass_test.cpp +++ b/pbv3/tools/pbv3_mass_test.cpp @@ -312,7 +312,7 @@ int main(int argc, char *argv[]) { return 1; } - std::shared_ptr<PBv3TB> tb = factory_pbv3tb.getPBv3TB("default"); + std::shared_ptr<PBv3TB> tb = factory_pbv3tb.getPBv3TB("default", type); if (tb == nullptr) return 1; /* if (tb->getLVPS()->getPowerSupply()->identify() == "SY5527") { -- GitLab From 08aeaf2357a10e6817148afaeff86fadfece2977 Mon Sep 17 00:00:00 2001 From: Ben Bruers <ben.brueers@cern.ch> Date: Mon, 9 Oct 2023 14:08:08 +0200 Subject: [PATCH 08/10] Fix formatting --- pbv3/PBv3TB.h | 1 + 1 file changed, 1 insertion(+) diff --git a/pbv3/PBv3TB.h b/pbv3/PBv3TB.h index ee100c5c..bf06b6e5 100644 --- a/pbv3/PBv3TB.h +++ b/pbv3/PBv3TB.h @@ -215,6 +215,7 @@ class PBv3TB { //! \brief Set the PB type void setPBPanelType(PBTypeDef::PBType type); + private: std::shared_ptr<DACDevice> m_CalDAC; -- GitLab From a4ef8dcb993447957b758acf5677dcaf4a1db5b8 Mon Sep 17 00:00:00 2001 From: DESY-Z DAQ Setup Computer <ben.brueers@cern.ch> Date: Mon, 9 Oct 2023 14:24:57 +0200 Subject: [PATCH 09/10] Remove unwanted changes --- CMakeLists.txt | 2 -- pbv3/PBv3TBModule.cpp | 1 - 2 files changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b9218af..144e72e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,8 +29,6 @@ else() endif() set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_FLAGS -Wno-psabi) - # labRemote dependency SET(OLD_BUILD_DOC ${BUILD_DOC}) diff --git a/pbv3/PBv3TBModule.cpp b/pbv3/PBv3TBModule.cpp index d88a1a6b..81b39bd9 100644 --- a/pbv3/PBv3TBModule.cpp +++ b/pbv3/PBv3TBModule.cpp @@ -53,7 +53,6 @@ void PBv3TBModule::init(const PBTypeDef::PBType pbType) { void PBv3TBModule::setOFin(uint8_t pbNum, bool value) { logger(logWARNING) << "OFin not implemented on module yet."; - return true; } double PBv3TBModule::getVin() { -- GitLab From f22e1be3a1a9104e6955a8278eefa4d630735660 Mon Sep 17 00:00:00 2001 From: DESY-Z DAQ Setup Computer <ben.brueers@cern.ch> Date: Mon, 9 Oct 2023 14:43:52 +0200 Subject: [PATCH 10/10] Change order in init, so InitDevices does not need pbType --- pbv3/PBv3TBMassive.cpp | 6 +++--- pbv3/PBv3TBMassive.h | 2 +- pbv3/PBv3TBMassive20190718.cpp | 4 ++-- pbv3/PBv3TBMassive20190718.h | 3 +-- pbv3/PBv3TBMassive20210504.cpp | 4 ++-- pbv3/PBv3TBMassive20210504.h | 3 +-- pbv3/PBv3TBMassive20210504Base.cpp | 8 ++++---- pbv3/PBv3TBMassive20210504Base.h | 3 +-- pbv3/PBv3TBMassive20210504_EC.cpp | 4 ++-- pbv3/PBv3TBMassive20210504_EC.h | 3 +-- pbv3/PBv3TBMassive20220329.cpp | 6 +++--- pbv3/PBv3TBMassive20220329.h | 3 +-- 12 files changed, 22 insertions(+), 27 deletions(-) diff --git a/pbv3/PBv3TBMassive.cpp b/pbv3/PBv3TBMassive.cpp index aa64b31a..5a0ea5dc 100644 --- a/pbv3/PBv3TBMassive.cpp +++ b/pbv3/PBv3TBMassive.cpp @@ -50,12 +50,12 @@ void PBv3TBMassive::setConfiguration(const nlohmann::json &config) { } void PBv3TBMassive::init(const PBTypeDef::PBType pbType) { - initDevices(pbType); - loadCalibrations(); setPBPanelType(pbType); + initDevices(); + loadCalibrations(); } -void PBv3TBMassive::initDevices(const PBTypeDef::PBType pbType) { +void PBv3TBMassive::initDevices() { // // Create the I2C mappings diff --git a/pbv3/PBv3TBMassive.h b/pbv3/PBv3TBMassive.h index ecf29f53..073efefb 100644 --- a/pbv3/PBv3TBMassive.h +++ b/pbv3/PBv3TBMassive.h @@ -196,7 +196,7 @@ class PBv3TBMassive : public PBv3TB { * and then call this implenentation to handle * the common chips. */ - virtual void initDevices(const PBTypeDef::PBType pbType); + virtual void initDevices(); //! Applies calibrations to devices virtual void loadCalibrations(); diff --git a/pbv3/PBv3TBMassive20190718.cpp b/pbv3/PBv3TBMassive20190718.cpp index 8eb7b802..944c1bb4 100644 --- a/pbv3/PBv3TBMassive20190718.cpp +++ b/pbv3/PBv3TBMassive20190718.cpp @@ -19,9 +19,9 @@ #include "PBv3TBRegistry.h" REGISTER_PBV3TB(PBv3TBMassive20190718) -void PBv3TBMassive20190718::initDevices(const PBTypeDef::PBType pbType) { +void PBv3TBMassive20190718::initDevices() { // Common - PBv3TBMassive::initDevices(pbType); + PBv3TBMassive::initDevices(); // Specific m_adc_pwr = std::make_shared<AD799X>( diff --git a/pbv3/PBv3TBMassive20190718.h b/pbv3/PBv3TBMassive20190718.h index e624f146..387a3eda 100644 --- a/pbv3/PBv3TBMassive20190718.h +++ b/pbv3/PBv3TBMassive20190718.h @@ -13,8 +13,7 @@ class PBv3TBMassive20190718 : public PBv3TBMassive { protected: //! Initialize devices on the active board - void initDevices( - const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); + void initDevices(); }; #endif // PBV3TBMASSIVE20190718_H diff --git a/pbv3/PBv3TBMassive20210504.cpp b/pbv3/PBv3TBMassive20210504.cpp index 21b7fdd2..13cec74e 100644 --- a/pbv3/PBv3TBMassive20210504.cpp +++ b/pbv3/PBv3TBMassive20210504.cpp @@ -4,8 +4,8 @@ #include "PBv3TBRegistry.h" REGISTER_PBV3TB(PBv3TBMassive20210504) -void PBv3TBMassive20210504::initDevices(const PBTypeDef::PBType pbType) { +void PBv3TBMassive20210504::initDevices() { m_pbsel_i2c_port = 0x38; // Common - PBv3TBMassive20210504Base::initDevices(pbType); + PBv3TBMassive20210504Base::initDevices(); } diff --git a/pbv3/PBv3TBMassive20210504.h b/pbv3/PBv3TBMassive20210504.h index f13a352f..81731d96 100644 --- a/pbv3/PBv3TBMassive20210504.h +++ b/pbv3/PBv3TBMassive20210504.h @@ -6,8 +6,7 @@ class PBv3TBMassive20210504 : public PBv3TBMassive20210504Base { protected: //! Initialize devices on the active board - virtual void initDevices( - const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); + virtual void initDevices(); }; #endif // PBV3TBMASSIVE20210504_H diff --git a/pbv3/PBv3TBMassive20210504Base.cpp b/pbv3/PBv3TBMassive20210504Base.cpp index 14210658..32299c2d 100644 --- a/pbv3/PBv3TBMassive20210504Base.cpp +++ b/pbv3/PBv3TBMassive20210504Base.cpp @@ -31,9 +31,9 @@ void PBv3TBMassive20210504Base::setConfiguration(const nlohmann::json &config) { PBv3TBMassive::setConfiguration(config); } -void PBv3TBMassive20210504Base::initDevices(const PBTypeDef::PBType pbType) { +void PBv3TBMassive20210504Base::initDevices() { // Common - PBv3TBMassive::initDevices(pbType); + PBv3TBMassive::initDevices(); // Specific m_adc_pwr = std::make_shared<AD799X>( @@ -56,8 +56,8 @@ void PBv3TBMassive20210504Base::initDevices(const PBTypeDef::PBType pbType) { bool invertCMDout = !m_zturn_adapter; // invert CMDin if powerboard is end-cap R0 or end-cap R1 - if (pbType == PBTypeDef::PBType::EC_R0 || - pbType == PBTypeDef::PBType::EC_R1) { + if (this->getPBPanelType() == PBTypeDef::PBType::EC_R0 || + this->getPBPanelType() == PBTypeDef::PBType::EC_R1) { invertCMDin = !invertCMDin; } diff --git a/pbv3/PBv3TBMassive20210504Base.h b/pbv3/PBv3TBMassive20210504Base.h index 9b8ad41c..2c5f7276 100644 --- a/pbv3/PBv3TBMassive20210504Base.h +++ b/pbv3/PBv3TBMassive20210504Base.h @@ -37,8 +37,7 @@ class PBv3TBMassive20210504Base : public PBv3TBMassive { protected: //! Initialize devices on the active board - virtual void initDevices( - const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); + virtual void initDevices(); //! I2C port for pb-selector mux uint8_t m_pbsel_i2c_port = 0; diff --git a/pbv3/PBv3TBMassive20210504_EC.cpp b/pbv3/PBv3TBMassive20210504_EC.cpp index c7fa3e35..bc9e60d4 100644 --- a/pbv3/PBv3TBMassive20210504_EC.cpp +++ b/pbv3/PBv3TBMassive20210504_EC.cpp @@ -4,8 +4,8 @@ #include "PBv3TBRegistry.h" REGISTER_PBV3TB(PBv3TBMassive20210504_EC) -void PBv3TBMassive20210504_EC::initDevices(const PBTypeDef::PBType pbType) { +void PBv3TBMassive20210504_EC::initDevices() { m_pbsel_i2c_port = 0x20; // Common - PBv3TBMassive20210504Base::initDevices(pbType); + PBv3TBMassive20210504Base::initDevices(); } diff --git a/pbv3/PBv3TBMassive20210504_EC.h b/pbv3/PBv3TBMassive20210504_EC.h index 1ffad645..02ceff85 100644 --- a/pbv3/PBv3TBMassive20210504_EC.h +++ b/pbv3/PBv3TBMassive20210504_EC.h @@ -6,8 +6,7 @@ class PBv3TBMassive20210504_EC : public PBv3TBMassive20210504Base { protected: //! Initialize devices on the active board - virtual void initDevices( - const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); + virtual void initDevices(); }; #endif // PBV3TBMASSIVE20210504_EC_H diff --git a/pbv3/PBv3TBMassive20220329.cpp b/pbv3/PBv3TBMassive20220329.cpp index 9ecab3f1..bd44a65b 100644 --- a/pbv3/PBv3TBMassive20220329.cpp +++ b/pbv3/PBv3TBMassive20220329.cpp @@ -53,7 +53,7 @@ void PBv3TBMassive20220329::setConfiguration(const nlohmann::json &config) { PBv3TBMassive::setConfiguration(config); } -void PBv3TBMassive20220329::initDevices(const PBTypeDef::PBType pbType) { +void PBv3TBMassive20220329::initDevices() { // Multiplexers m_i2c_root = std::make_shared<I2CDevCom>(0x70, m_i2cdev); @@ -137,8 +137,8 @@ void PBv3TBMassive20220329::initDevices(const PBTypeDef::PBType pbType) { bool invertCMDout = !m_zturn_adapter; // invert CMDin if powerboard is end-cap R0 or end-cap R1 - if (pbType == PBTypeDef::PBType::EC_R0 || - pbType == PBTypeDef::PBType::EC_R1) { + if (this->getPBPanelType() == PBTypeDef::PBType::EC_R0 || + this->getPBPanelType() == PBTypeDef::PBType::EC_R1) { invertCMDin = !invertCMDin; } diff --git a/pbv3/PBv3TBMassive20220329.h b/pbv3/PBv3TBMassive20220329.h index 0d7ec998..0b878ac4 100644 --- a/pbv3/PBv3TBMassive20220329.h +++ b/pbv3/PBv3TBMassive20220329.h @@ -46,8 +46,7 @@ class PBv3TBMassive20220329 : public PBv3TBMassive { protected: //! Initialize devices on the active board - virtual void initDevices( - const PBTypeDef::PBType pbType = PBTypeDef::PBType::BARREL); + virtual void initDevices(); private: //! ZTurn adapter is in use -- GitLab