From dc3dffbea67f4feb9e0db37e7d824c5c2135673c Mon Sep 17 00:00:00 2001 From: Sylvain Chapeland Date: Fri, 15 Sep 2023 10:57:47 +0200 Subject: [PATCH 1/3] dropped python 2.7 support --- CMakeLists.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 48824a3..576688b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,11 +73,6 @@ if(NOT APPLE) find_package(Python3 3.6 COMPONENTS Interpreter Development) if(Python3_FOUND) set(boost_python_component "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}") - else() - # Backwards compatible. Can be removed once the Python3 recipe is stable - message(WARNING "Python 3 was not found: falling back to Python 2") - find_package(Python2 2.7 COMPONENTS Development REQUIRED) - set(boost_python_component "python27") endif() endif() @@ -99,7 +94,6 @@ target_sources(ALF PRIVATE src/AlfServer.cxx src/DimServices/DimServices.cxx src/DimServices/ServiceNames.cxx - $<$:src/PythonInterface.cxx> $<$:src/PythonInterface.cxx> ) @@ -116,8 +110,6 @@ set(LINK_LIBS AliceO2::ReadoutCard AliceO2::Common Boost::boost - $<$:Boost::python27> - $<$:Python2::Python> $<$:Boost::python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}> $<$:Python3::Python> ) From 334bece715a6c7bdae641c20a8c577784f0521ba Mon Sep 17 00:00:00 2001 From: Sylvain Chapeland Date: Mon, 2 Oct 2023 16:22:55 +0200 Subject: [PATCH 2/3] updated pattern player - new parameters --- README.md | 30 +++++++++++++--------- src/AlfServer.cxx | 64 +---------------------------------------------- 2 files changed, 19 insertions(+), 75 deletions(-) diff --git a/README.md b/README.md index 9ab0b83..74ad5d2 100644 --- a/README.md +++ b/README.md @@ -165,23 +165,29 @@ It extends the `SCA_SEQUENCE` to add the following functionality: ##### PATTERN_PLAYER * Parameters - * Sync Pattern - * Reset Pattern - * Idle Pattern - * Sync Length - * Sync Delay - * Reset Length - * Reset Trigger Select - * Sync Trigger Select - * Sync At Start - * Trigger Sync - * Trigger Reset + * pat0 Pattern + * pat1 Pattern + * pat2 Pattern + * pat3 Pattern + * pat1 Length + * pat1 Delay + * pat2 Length + * pat3 Length + * pat1 Trigger Select + * pat2 Trigger Select + * pat3 Trigger Select + * pat2 TF[31:20] ORBIT[19:12] BC[11:0] + * execute pat1 at start + * execute pat1 now + * execute pat2 now + + see [registers definition](https://gitlab.cern.ch/alice-cru/cru-fw/-/tree/pplayer/TTC#address-table) * Returns * empty * Example: - * DIM input `0x23456789abcdef123456\n0x5678\n0x9abc\n42\n0\n53\n30\n29\n#a comment\nfalse\ntrue\nfalse` + * DIM input `0x123\n123\n1024\n0xFFFFFFFFFFFFFFFFFFFF\n10\n11\n20\n30\n0xFF\n0xEE\n0xDDDe\n0xAAABBCCC\n#comment\nfalse\ntrue\ntrue` * DIM output ` ` ##### LLA_SESSION_START diff --git a/src/AlfServer.cxx b/src/AlfServer.cxx index 5c5d6f4..4f47f4c 100644 --- a/src/AlfServer.cxx +++ b/src/AlfServer.cxx @@ -147,9 +147,6 @@ std::string AlfServer::icGbtI2cWrite(const std::string& parameter, AlfLink link) std::string AlfServer::patternPlayer(const std::string& parameter, std::shared_ptr bar2) { std::vector parameters = Util::split(parameter, argumentSeparator()); - if (parameters.size() < 11) { // Test that we have enough parameters - BOOST_THROW_EXCEPTION(AlfException() << ErrorInfo::Message("Wrong number of parameters for the Pattern Player RPC call: " + std::to_string(parameters.size()))); - } roc::PatternPlayer::Info info = parseStringToPatternPlayerInfo(parameters); @@ -213,66 +210,7 @@ std::string AlfServer::resetCard(const std::string& /*parameter*/, AlfLink link) roc::PatternPlayer::Info AlfServer::parseStringToPatternPlayerInfo(const std::vector parameters) { - roc::PatternPlayer::Info ppInfo; - - int infoField = 0; - for (const auto& parameter : parameters) { - if (parameter.find('#') == std::string::npos) { - infoField++; - } - } - - if (infoField != 11) { // Test that we have enough non-comment parameters - BOOST_THROW_EXCEPTION(AlfException() << ErrorInfo::Message("Wrong number of non-comment parameters for the Pattern Player RPC call: " + std::to_string(infoField))); - } - - infoField = 0; - for (const auto& parameter : parameters) { - if (parameter.find('#') == std::string::npos) { - switch (infoField) { - bool boolValue; - case 0: - ppInfo.syncPattern = uint128_t(parameter); - break; - case 1: - ppInfo.resetPattern = uint128_t(parameter); - break; - case 2: - ppInfo.idlePattern = uint128_t(parameter); - break; - case 3: - ppInfo.syncLength = std::stoi(parameter); - break; - case 4: - ppInfo.syncDelay = std::stoi(parameter); - break; - case 5: - ppInfo.resetLength = std::stoi(parameter); - break; - case 6: - ppInfo.resetTriggerSelect = std::stoi(parameter); - break; - case 7: - ppInfo.syncTriggerSelect = std::stoi(parameter); - break; - case 8: - std::istringstream(parameter) >> std::boolalpha >> boolValue; - ppInfo.syncAtStart = boolValue; - break; - case 9: - std::istringstream(parameter) >> std::boolalpha >> boolValue; - ppInfo.triggerSync = boolValue; - break; - case 10: - std::istringstream(parameter) >> std::boolalpha >> boolValue; - ppInfo.triggerReset = boolValue; - break; - } - infoField++; - } - } - - return ppInfo; + return roc::PatternPlayer::getInfoFromString(parameters); } std::vector AlfServer::stringToRegisterPair(const std::string stringPair) From 643e059db9347413338b099dfd21a18b40c291e9 Mon Sep 17 00:00:00 2001 From: Sylvain Chapeland Date: Tue, 3 Oct 2023 11:04:16 +0200 Subject: [PATCH 3/3] decoding of roc errors --- src/AlfServer.cxx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/AlfServer.cxx b/src/AlfServer.cxx index 4f47f4c..c9f2886 100644 --- a/src/AlfServer.cxx +++ b/src/AlfServer.cxx @@ -147,11 +147,19 @@ std::string AlfServer::icGbtI2cWrite(const std::string& parameter, AlfLink link) std::string AlfServer::patternPlayer(const std::string& parameter, std::shared_ptr bar2) { std::vector parameters = Util::split(parameter, argumentSeparator()); - - roc::PatternPlayer::Info info = parseStringToPatternPlayerInfo(parameters); - - roc::PatternPlayer pp = roc::PatternPlayer(bar2); - pp.play(info); + try { + roc::PatternPlayer::Info info = parseStringToPatternPlayerInfo(parameters); + roc::PatternPlayer pp = roc::PatternPlayer(bar2); + pp.play(info); + } + catch(boost::exception const& e) { + auto info = boost::get_error_info(e); + if (info) { + BOOST_THROW_EXCEPTION(AlfException() << ErrorInfo::Message(info->data())); + } else { + throw; + } + } return ""; }