merge fix

This commit is contained in:
maliakal_d 2021-08-06 16:11:58 +02:00
commit cc3aede979
17 changed files with 126 additions and 122 deletions

View File

@ -12,7 +12,7 @@ import subprocess
from parse import remove_comments from parse import remove_comments
allow_bitwise_op = ["M3_GainCaps"] allow_bitwise_op = ["M3_GainCaps"]
allow_bitwise_op = ["ethernetInterface"] allow_bitwise_op = ["streamingInterface"]
op_key = {"operator|": "__or__", op_key = {"operator|": "__or__",
"operator&" : "__and__"} "operator&" : "__and__"}
@ -23,7 +23,7 @@ def single_line_enum(line):
def extract_enums(lines): def extract_enums(lines):
# deal with enum class ethernetInterface : int32_t # deal with enum class streamingInterface : int32_t
# and normal enum burstMode { # and normal enum burstMode {
line_iter = iter(lines) line_iter = iter(lines)
@ -90,7 +90,7 @@ def generate_enum_string(enums):
#Here add the operators #Here add the operators
for op in operators: for op in operators:
data.append(f"\n\t.def(\"{op_key[op]}\", py::overload_cast< const slsDetectorDefs::ethernetInterface&, const slsDetectorDefs::ethernetInterface&>(&{op}))") data.append(f"\n\t.def(\"{op_key[op]}\", py::overload_cast< const slsDetectorDefs::streamingInterface&, const slsDetectorDefs::streamingInterface&>(&{op}))")
data.append(';\n\n') data.append(';\n\n')

View File

@ -7,7 +7,7 @@ timingMode = slsDetectorDefs.timingMode
speedLevel = slsDetectorDefs.speedLevel speedLevel = slsDetectorDefs.speedLevel
dacIndex = slsDetectorDefs.dacIndex dacIndex = slsDetectorDefs.dacIndex
detectorType = slsDetectorDefs.detectorType detectorType = slsDetectorDefs.detectorType
ethernetInterface = slsDetectorDefs.ethernetInterface streamingInterface = slsDetectorDefs.streamingInterface
defs = slsDetectorDefs defs = slsDetectorDefs
@ -2357,7 +2357,7 @@ class Detector(CppDetectorApi):
Note Note
---- ----
Default: both off Default: both off
Options: NONE, I3GBE, 10GBE (debugging) Options: NONE, LOW_LATENCY_LINK, 10GBE (debugging)
Debugging interface also enables second interface in receiver (separate file), which also restarts zmq streaming if enabled. Debugging interface also enables second interface in receiver (separate file), which also restarts zmq streaming if enabled.
""" """
return self.getVetoStream() return self.getVetoStream()
@ -2373,10 +2373,10 @@ class Detector(CppDetectorApi):
"""[Gotthard2] Algorithm used for veto """[Gotthard2] Algorithm used for veto
Example Example
---------- ----------
>>> d.vetoalg = defs.DEFAULT_ALGORITHM, defs.I10GBE >>> d.vetoalg = defs.DEFAULT_ALGORITHM, defs.ETHERNET_10GB
""" """
result = {} result = {}
interface = [ethernetInterface.I3GBE, ethernetInterface.I10GBE] interface = [streamingInterface.LOW_LATENCY_LINK, streamingInterface.ETHERNET_10GB]
for eth in interface: for eth in interface:
result[eth] = element_if_equal(self.getVetoAlgorithm(eth)) result[eth] = element_if_equal(self.getVetoAlgorithm(eth))
return result return result

View File

@ -1087,23 +1087,23 @@ void init_det(py::module &m) {
Detector::setVeto, Detector::setVeto,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getVetoStream", .def("getVetoStream",
(Result<defs::ethernetInterface>(Detector::*)(sls::Positions) (Result<defs::streamingInterface>(Detector::*)(sls::Positions)
const) & const) &
Detector::getVetoStream, Detector::getVetoStream,
py::arg() = Positions{}) py::arg() = Positions{})
.def("setVetoStream", .def("setVetoStream",
(void (Detector::*)(const defs::ethernetInterface, (void (Detector::*)(const defs::streamingInterface,
sls::Positions)) & sls::Positions)) &
Detector::setVetoStream, Detector::setVetoStream,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getVetoAlgorithm", .def("getVetoAlgorithm",
(Result<defs::vetoAlgorithm>(Detector::*)( (Result<defs::vetoAlgorithm>(Detector::*)(
const defs::ethernetInterface, sls::Positions) const) & const defs::streamingInterface, sls::Positions) const) &
Detector::getVetoAlgorithm, Detector::getVetoAlgorithm,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("setVetoAlgorithm", .def("setVetoAlgorithm",
(void (Detector::*)(const defs::vetoAlgorithm, (void (Detector::*)(const defs::vetoAlgorithm,
const defs::ethernetInterface, const defs::streamingInterface,
sls::Positions)) & sls::Positions)) &
Detector::setVetoAlgorithm, Detector::setVetoAlgorithm,
py::arg(), py::arg(), py::arg() = Positions{}) py::arg(), py::arg(), py::arg() = Positions{})

View File

@ -289,20 +289,20 @@ void init_enums(py::module &m) {
.value("BOTTOM", slsDetectorDefs::portPosition::BOTTOM) .value("BOTTOM", slsDetectorDefs::portPosition::BOTTOM)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::ethernetInterface>(Defs, "ethernetInterface", py::enum_<slsDetectorDefs::streamingInterface>(Defs, "streamingInterface",
py::arithmetic()) py::arithmetic())
.value("NONE", slsDetectorDefs::ethernetInterface::NONE) .value("NONE", slsDetectorDefs::streamingInterface::NONE)
.value("I3GBE", slsDetectorDefs::ethernetInterface::I3GBE) .value("LOW_LATENCY_LINK", slsDetectorDefs::streamingInterface::LOW_LATENCY_LINK)
.value("I10GBE", slsDetectorDefs::ethernetInterface::I10GBE) .value("ETHERNET_10GB", slsDetectorDefs::streamingInterface::ETHERNET_10GB)
.value("ALL", slsDetectorDefs::ethernetInterface::ALL) .value("ALL", slsDetectorDefs::streamingInterface::ALL)
.export_values() .export_values()
.def("__or__", .def("__or__",
py::overload_cast<const slsDetectorDefs::ethernetInterface &, py::overload_cast<const slsDetectorDefs::streamingInterface &,
const slsDetectorDefs::ethernetInterface &>( const slsDetectorDefs::streamingInterface &>(
&operator|)) &operator|))
.def("__and__", .def("__and__",
py::overload_cast<const slsDetectorDefs::ethernetInterface &, py::overload_cast<const slsDetectorDefs::streamingInterface &,
const slsDetectorDefs::ethernetInterface &>( const slsDetectorDefs::streamingInterface &>(
&operator&)); &operator&));
py::enum_<slsDetectorDefs::vetoAlgorithm>(Defs, "vetoAlgorithm") py::enum_<slsDetectorDefs::vetoAlgorithm>(Defs, "vetoAlgorithm")

View File

@ -1716,10 +1716,10 @@ int configureMAC() {
"\tDest Port : %d\n\n", "\tDest Port : %d\n\n",
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport)); src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
int i3gbe = getVetoStream(); int lll = getVetoStream();
int i10gbe = (getNumberofUDPInterfaces() == 2 ? 1 : 0); int i10gbe = (getNumberofUDPInterfaces() == 2 ? 1 : 0);
if (i3gbe) { if (lll) {
LOG(logINFOGREEN, ("\tVeto (3GbE) : enabled\n\n")); LOG(logINFOGREEN, ("\tVeto (3GbE) : enabled\n\n"));
} else { } else {
LOG(logINFORED, ("\tVeto (3GbE) : disabled\n\n")); LOG(logINFORED, ("\tVeto (3GbE) : disabled\n\n"));
@ -2606,9 +2606,9 @@ int getVetoStream() {
return ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_3GB_ENBL_MSK) ? 1 : 0); return ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_3GB_ENBL_MSK) ? 1 : 0);
} }
enum vetoAlgorithm getVetoAlgorithm(enum ethernetInterface interface) { enum vetoAlgorithm getVetoAlgorithm(enum streamingInterface interface) {
// 3gbe // 3gbe
if (interface == I3GBE) { if (interface == LOW_LATENCY_LINK) {
int retval = ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_3GB_ALG_MSK) >> int retval = ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_3GB_ALG_MSK) >>
CONFIG_VETO_CH_3GB_ALG_OFST); CONFIG_VETO_CH_3GB_ALG_OFST);
switch (retval) { switch (retval) {
@ -2633,14 +2633,14 @@ enum vetoAlgorithm getVetoAlgorithm(enum ethernetInterface interface) {
} }
} }
void setVetoAlgorithm(enum ethernetInterface interface, void setVetoAlgorithm(enum streamingInterface interface,
enum vetoAlgorithm alg) { enum vetoAlgorithm alg) {
uint32_t addr = CONFIG_REG; uint32_t addr = CONFIG_REG;
uint32_t value = bus_r(addr); uint32_t value = bus_r(addr);
switch (alg) { switch (alg) {
// more to follow // more to follow
case DEFAULT_ALGORITHM: case DEFAULT_ALGORITHM:
if (interface == I3GBE) { if (interface == LOW_LATENCY_LINK) {
LOG(logINFO, ("Setting default veto algorithm for 3Gbe\n")); LOG(logINFO, ("Setting default veto algorithm for 3Gbe\n"));
value &= (~CONFIG_VETO_CH_3GB_ALG_MSK); value &= (~CONFIG_VETO_CH_3GB_ALG_MSK);
value |= CONFIG_VETO_CH_3GB_ALG_DEFAULT_VAL; value |= CONFIG_VETO_CH_3GB_ALG_DEFAULT_VAL;

View File

@ -532,8 +532,8 @@ void setVeto(int enable);
int getVeto(); int getVeto();
void setVetoStream(int value); void setVetoStream(int value);
int getVetoStream(); int getVetoStream();
enum vetoAlgorithm getVetoAlgorithm(enum ethernetInterface interface); enum vetoAlgorithm getVetoAlgorithm(enum streamingInterface interface);
void setVetoAlgorithm(enum ethernetInterface interface, enum vetoAlgorithm alg); void setVetoAlgorithm(enum streamingInterface interface, enum vetoAlgorithm alg);
void setBadChannels(int nch, int *channels); void setBadChannels(int nch, int *channels);
int *getBadChannels(int *nch); int *getBadChannels(int *nch);
#endif #endif

View File

@ -8321,7 +8321,7 @@ int set_datastream(int file_des) {
int get_veto_stream(int file_des) { int get_veto_stream(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
enum ethernetInterface retval = NONE; enum streamingInterface retval = NONE;
LOG(logDEBUG1, ("Getting veto stream\n")); LOG(logDEBUG1, ("Getting veto stream\n"));
@ -8338,7 +8338,7 @@ int get_veto_stream(int file_des) {
int set_veto_stream(int file_des) { int set_veto_stream(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
enum ethernetInterface arg = 0; enum streamingInterface arg = 0;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError(); return printSocketReadError();
@ -8370,7 +8370,7 @@ int set_veto_stream(int file_des) {
int get_veto_algorithm(int file_des) { int get_veto_algorithm(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
enum ethernetInterface arg = NONE; enum streamingInterface arg = NONE;
enum vetoAlgorithm retval = DEFAULT_ALGORITHM; enum vetoAlgorithm retval = DEFAULT_ALGORITHM;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError(); return printSocketReadError();
@ -8381,7 +8381,7 @@ int get_veto_algorithm(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// get only // get only
if (arg != I3GBE && arg != I10GBE) { if (arg != LOW_LATENCY_LINK && arg != ETHERNET_10GB) {
ret = FAIL; ret = FAIL;
sprintf(mess, "Could not get vetoalgorithm. Invalid interface %d.\n", sprintf(mess, "Could not get vetoalgorithm. Invalid interface %d.\n",
arg); arg);
@ -8402,7 +8402,7 @@ int set_veto_algorithm(int file_des) {
return printSocketReadError(); return printSocketReadError();
enum vetoAlgorithm alg = args[0]; enum vetoAlgorithm alg = args[0];
enum ethernetInterface interface = args[1]; enum streamingInterface interface = args[1];
LOG(logINFO, ("Setting vetoalgorithm (interface: %d): %u\n", (int)interface, LOG(logINFO, ("Setting vetoalgorithm (interface: %d): %u\n", (int)interface,
(int)alg)); (int)alg));
@ -8411,7 +8411,7 @@ int set_veto_algorithm(int file_des) {
#else #else
// only set // only set
if (Server_VerifyLock() == OK) { if (Server_VerifyLock() == OK) {
if (interface != I3GBE && interface != I10GBE) { if (interface != LOW_LATENCY_LINK && interface != ETHERNET_10GB) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
"Could not set vetoalgorithm. Invalid interface %d.\n", "Could not set vetoalgorithm. Invalid interface %d.\n",

View File

@ -1263,26 +1263,26 @@ class Detector {
void setVeto(const bool enable, Positions pos = {}); void setVeto(const bool enable, Positions pos = {});
/** [Gotthard2] */ /** [Gotthard2] */
Result<defs::ethernetInterface> getVetoStream(Positions pos = {}) const; Result<defs::streamingInterface> getVetoStream(Positions pos = {}) const;
/** [Gotthard2] Options: NONE (Default), I3GBE, I10GBE (debugging), ALL /** [Gotthard2] Options: NONE (Default), LOW_LATENCY_LINK, ETHERNET_10GB (debugging), ALL
* Enable or disable the 2 veto streaming interfaces available. Can * Enable or disable the 2 veto streaming interfaces available. Can
* concatenate more than one interface. \n3GbE (2.5GbE) is the default * concatenate more than one interface. \nLOW_LATENCY_LINK is the default
* interface to work with. \n10GbE is for debugging and also enables second * interface to work with. \nETHERNET_10GB is for debugging and also enables second
* interface in receiver for listening to veto packets (writes a separate * interface in receiver for listening to veto packets (writes a separate
* file if writing enabled). Also restarts client and receiver zmq sockets * file if writing enabled). Also restarts client and receiver zmq sockets
* if zmq streaming enabled.*/ * if zmq streaming enabled.*/
void setVetoStream(const defs::ethernetInterface value, Positions pos = {}); void setVetoStream(const defs::streamingInterface value, Positions pos = {});
/** [Gotthard2] */ /** [Gotthard2] */
Result<defs::vetoAlgorithm> Result<defs::vetoAlgorithm>
getVetoAlgorithm(const defs::ethernetInterface value, getVetoAlgorithm(const defs::streamingInterface value,
Positions pos = {}) const; Positions pos = {}) const;
/** [Gotthard2] Options(vetoAlgorithm): DEFAULT_ALGORITHM. /** [Gotthard2] Options(vetoAlgorithm): DEFAULT_ALGORITHM.
* Options(ethernetInterface): I3GBE, I10GBE */ * Options(streamingInterface): LOW_LATENCY_LINK, ETHERNET_10GB */
void setVetoAlgorithm(const defs::vetoAlgorithm alg, void setVetoAlgorithm(const defs::vetoAlgorithm alg,
const defs::ethernetInterface value, const defs::streamingInterface value,
Positions pos = {}); Positions pos = {});
/** [Gotthard2] */ /** [Gotthard2] */

View File

@ -1869,9 +1869,9 @@ std::string CmdProxy::VetoStreaming(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[none|3gbe|10gbe|...]\n\t[Gotthard2] Enable or disable the 2 " os << "[none|lll|10gbe|...]\n\t[Gotthard2] Enable or disable the 2 "
"veto streaming interfaces available. Can include more than one " "veto streaming interfaces available. Can include more than one "
"interface. \n\tDefault: none. 3GbE (2.5GbE) is the default " "interface. \n\tDefault: none. lll (low latency link) is the default "
"interface to work with. \n\t10GbE is for debugging and also " "interface to work with. \n\t10GbE is for debugging and also "
"enables second interface in receiver for listening to veto " "enables second interface in receiver for listening to veto "
"packets (writes a separate file if writing enabled). Also " "packets (writes a separate file if writing enabled). Also "
@ -1888,7 +1888,7 @@ std::string CmdProxy::VetoStreaming(int action) {
if (args.empty()) { if (args.empty()) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
defs::ethernetInterface interface = defs::ethernetInterface::NONE; defs::streamingInterface interface = defs::streamingInterface::NONE;
for (const auto &arg : args) { for (const auto &arg : args) {
if (arg == "none") { if (arg == "none") {
if (args.size() > 1) { if (args.size() > 1) {
@ -1899,7 +1899,7 @@ std::string CmdProxy::VetoStreaming(int action) {
} }
break; break;
} }
interface = interface | (StringTo<defs::ethernetInterface>(arg)); interface = interface | (StringTo<defs::streamingInterface>(arg));
} }
det->setVetoStream(interface, std::vector<int>{det_id}); det->setVetoStream(interface, std::vector<int>{det_id});
os << ToString(interface) << '\n'; os << ToString(interface) << '\n';
@ -1913,16 +1913,16 @@ std::string CmdProxy::VetoAlgorithm(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[default] [3gbe|10gbe]\n\t[Gotthard2] Set the veto " os << "[default] [lll|10gbe]\n\t[Gotthard2] Set the veto "
"algorithm." "algorithm."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
defs::ethernetInterface interface = defs::streamingInterface interface =
StringTo<defs::ethernetInterface>(args[0]); StringTo<defs::streamingInterface>(args[0]);
if (interface == defs::ethernetInterface::NONE) { if (interface == defs::streamingInterface::NONE) {
throw sls::RuntimeError( throw sls::RuntimeError(
"Must specify an interface to set algorithm"); "Must specify an interface to set algorithm");
} }
@ -1933,9 +1933,9 @@ std::string CmdProxy::VetoAlgorithm(int action) {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
} }
defs::vetoAlgorithm alg = StringTo<defs::vetoAlgorithm>(args[0]); defs::vetoAlgorithm alg = StringTo<defs::vetoAlgorithm>(args[0]);
defs::ethernetInterface interface = defs::streamingInterface interface =
StringTo<defs::ethernetInterface>(args[1]); StringTo<defs::streamingInterface>(args[1]);
if (interface == defs::ethernetInterface::NONE) { if (interface == defs::streamingInterface::NONE) {
throw sls::RuntimeError( throw sls::RuntimeError(
"Must specify an interface to set algorithm"); "Must specify an interface to set algorithm");
} }

View File

@ -1578,34 +1578,34 @@ void Detector::setVeto(bool enable, Positions pos) {
pimpl->Parallel(&Module::setVeto, pos, enable); pimpl->Parallel(&Module::setVeto, pos, enable);
} }
Result<defs::ethernetInterface> Detector::getVetoStream(Positions pos) const { Result<defs::streamingInterface> Detector::getVetoStream(Positions pos) const {
// 3gbe // 3gbe
auto r3 = pimpl->Parallel(&Module::getVetoStream, pos); auto r3 = pimpl->Parallel(&Module::getVetoStream, pos);
// 10gbe (debugging interface) opens 2nd udp interface in receiver // 10gbe (debugging interface) opens 2nd udp interface in receiver
auto r10 = getNumberofUDPInterfaces_(pos); auto r10 = getNumberofUDPInterfaces_(pos);
Result<defs::ethernetInterface> res(r3.size()); Result<defs::streamingInterface> res(r3.size());
for (unsigned int i = 0; i < res.size(); ++i) { for (unsigned int i = 0; i < res.size(); ++i) {
res[i] = (r3[i] ? defs::ethernetInterface::I3GBE res[i] = (r3[i] ? defs::streamingInterface::LOW_LATENCY_LINK
: defs::ethernetInterface::NONE); : defs::streamingInterface::NONE);
if (r10[i] == 2) { if (r10[i] == 2) {
res[i] = res[i] | defs::ethernetInterface::I10GBE; res[i] = res[i] | defs::streamingInterface::ETHERNET_10GB;
} }
} }
return res; return res;
} }
void Detector::setVetoStream(defs::ethernetInterface interface, Positions pos) { void Detector::setVetoStream(defs::streamingInterface interface, Positions pos) {
// 3gbe // 3gbe
bool i3gbe = ((interface & defs::ethernetInterface::I3GBE) == bool LOW_LATENCY_LINK = ((interface & defs::streamingInterface::LOW_LATENCY_LINK) ==
defs::ethernetInterface::I3GBE); defs::streamingInterface::LOW_LATENCY_LINK);
pimpl->Parallel(&Module::setVetoStream, pos, i3gbe); pimpl->Parallel(&Module::setVetoStream, pos, LOW_LATENCY_LINK);
// 10gbe (debugging interface) opens 2nd udp interface in receiver // 10gbe (debugging interface) opens 2nd udp interface in receiver
int old_numinterfaces = getNumberofUDPInterfaces_(pos).tsquash( int old_numinterfaces = getNumberofUDPInterfaces_(pos).tsquash(
"retrieved inconsistent number of udp interfaces"); "retrieved inconsistent number of udp interfaces");
int numinterfaces = (((interface & defs::ethernetInterface::I10GBE) == int numinterfaces = (((interface & defs::streamingInterface::ETHERNET_10GB) ==
defs::ethernetInterface::I10GBE) defs::streamingInterface::ETHERNET_10GB)
? 2 ? 2
: 1); : 1);
if (numinterfaces != old_numinterfaces) { if (numinterfaces != old_numinterfaces) {
@ -1614,13 +1614,13 @@ void Detector::setVetoStream(defs::ethernetInterface interface, Positions pos) {
} }
Result<defs::vetoAlgorithm> Result<defs::vetoAlgorithm>
Detector::getVetoAlgorithm(const defs::ethernetInterface interface, Detector::getVetoAlgorithm(const defs::streamingInterface interface,
Positions pos) const { Positions pos) const {
return pimpl->Parallel(&Module::getVetoAlgorithm, pos, interface); return pimpl->Parallel(&Module::getVetoAlgorithm, pos, interface);
} }
void Detector::setVetoAlgorithm(const defs::vetoAlgorithm alg, void Detector::setVetoAlgorithm(const defs::vetoAlgorithm alg,
defs::ethernetInterface interface, defs::streamingInterface interface,
Positions pos) { Positions pos) {
pimpl->Parallel(&Module::setVetoAlgorithm, pos, alg, interface); pimpl->Parallel(&Module::setVetoAlgorithm, pos, alg, interface);
} }

View File

@ -1896,14 +1896,14 @@ void Module::setVetoStream(const bool value) {
} }
slsDetectorDefs::vetoAlgorithm Module::getVetoAlgorithm( slsDetectorDefs::vetoAlgorithm Module::getVetoAlgorithm(
const slsDetectorDefs::ethernetInterface interface) const { const slsDetectorDefs::streamingInterface interface) const {
return sendToDetector<vetoAlgorithm>(F_GET_VETO_ALGORITHM, return sendToDetector<vetoAlgorithm>(F_GET_VETO_ALGORITHM,
static_cast<int>(interface)); static_cast<int>(interface));
} }
void Module::setVetoAlgorithm( void Module::setVetoAlgorithm(
const slsDetectorDefs::vetoAlgorithm alg, const slsDetectorDefs::vetoAlgorithm alg,
const slsDetectorDefs::ethernetInterface interface) { const slsDetectorDefs::streamingInterface interface) {
int args[]{static_cast<int>(alg), static_cast<int>(interface)}; int args[]{static_cast<int>(alg), static_cast<int>(interface)};
sendToDetector(F_SET_VETO_ALGORITHM, args, nullptr); sendToDetector(F_SET_VETO_ALGORITHM, args, nullptr);
} }

View File

@ -411,9 +411,9 @@ class Module : public virtual slsDetectorDefs {
bool getVetoStream() const; bool getVetoStream() const;
void setVetoStream(const bool value); void setVetoStream(const bool value);
slsDetectorDefs::vetoAlgorithm slsDetectorDefs::vetoAlgorithm
getVetoAlgorithm(const slsDetectorDefs::ethernetInterface interface) const; getVetoAlgorithm(const slsDetectorDefs::streamingInterface interface) const;
void setVetoAlgorithm(const slsDetectorDefs::vetoAlgorithm alg, void setVetoAlgorithm(const slsDetectorDefs::vetoAlgorithm alg,
const slsDetectorDefs::ethernetInterface interface); const slsDetectorDefs::streamingInterface interface);
int getADCConfiguration(const int chipIndex, const int adcIndex) const; int getADCConfiguration(const int chipIndex, const int adcIndex) const;
void setADCConfiguration(const int chipIndex, const int adcIndex, void setADCConfiguration(const int chipIndex, const int adcIndex,
int value); int value);

View File

@ -657,25 +657,25 @@ TEST_CASE("vetostream", "[.cmd]") {
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("vetostream", {"3gbe"}, -1, PUT, oss); proxy.Call("vetostream", {"lll"}, -1, PUT, oss);
REQUIRE(oss.str() == "vetostream 3gbe\n"); REQUIRE(oss.str() == "vetostream lll\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("vetostream", {}, -1, GET, oss); proxy.Call("vetostream", {}, -1, GET, oss);
REQUIRE(oss.str() == "vetostream 3gbe\n"); REQUIRE(oss.str() == "vetostream lll\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("vetostream", {"3gbe", "10gbe"}, -1, PUT, oss); proxy.Call("vetostream", {"lll", "10gbe"}, -1, PUT, oss);
REQUIRE(oss.str() == "vetostream 3gbe, 10gbe\n"); REQUIRE(oss.str() == "vetostream lll, 10gbe\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("vetostream", {}, -1, GET, oss); proxy.Call("vetostream", {}, -1, GET, oss);
REQUIRE(oss.str() == "vetostream 3gbe, 10gbe\n"); REQUIRE(oss.str() == "vetostream lll, 10gbe\n");
} }
REQUIRE_THROWS(proxy.Call("vetostream", {"3gbe", "none"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("vetostream", {"lll", "none"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setVetoStream(prev_val[i], {i}); det.setVetoStream(prev_val[i], {i});
} }
@ -691,18 +691,18 @@ TEST_CASE("vetoalg", "[.cmd]") {
CmdProxy proxy(&det); CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) { if (det_type == defs::GOTTHARD2) {
auto prev_val_3g = det.getVetoAlgorithm(defs::ethernetInterface::I3GBE); auto prev_val_3g = det.getVetoAlgorithm(defs::streamingInterface::LOW_LATENCY_LINK);
auto prev_val_10g = auto prev_val_10g =
det.getVetoAlgorithm(defs::ethernetInterface::I10GBE); det.getVetoAlgorithm(defs::streamingInterface::ETHERNET_10GB);
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("vetoalg", {"default", "3gbe"}, -1, PUT, oss); proxy.Call("vetoalg", {"default", "lll"}, -1, PUT, oss);
REQUIRE(oss.str() == "vetoalg default 3gbe\n"); REQUIRE(oss.str() == "vetoalg default lll\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("vetoalg", {"3gbe"}, -1, GET, oss); proxy.Call("vetoalg", {"lll"}, -1, GET, oss);
REQUIRE(oss.str() == "vetoalg default 3gbe\n"); REQUIRE(oss.str() == "vetoalg default lll\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
@ -715,16 +715,16 @@ TEST_CASE("vetoalg", "[.cmd]") {
REQUIRE(oss.str() == "vetoalg default 10gbe\n"); REQUIRE(oss.str() == "vetoalg default 10gbe\n");
} }
REQUIRE_THROWS( REQUIRE_THROWS(
proxy.Call("vetoalg", {"default", "3gbe", "10gbe"}, -1, PUT)); proxy.Call("vetoalg", {"default", "lll", "10gbe"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("vetoalg", {"default", "none"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("vetoalg", {"default", "none"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setVetoAlgorithm(prev_val_3g[i], defs::ethernetInterface::I3GBE, det.setVetoAlgorithm(prev_val_3g[i], defs::streamingInterface::LOW_LATENCY_LINK,
{i}); {i});
det.setVetoAlgorithm(prev_val_10g[i], det.setVetoAlgorithm(prev_val_10g[i],
defs::ethernetInterface::I10GBE, {i}); defs::streamingInterface::ETHERNET_10GB, {i});
} }
} else { } else {
REQUIRE_THROWS(proxy.Call("vetoalg", {"3gbe"}, -1, GET)); REQUIRE_THROWS(proxy.Call("vetoalg", {"lll"}, -1, GET));
REQUIRE_THROWS(proxy.Call("vetoalg", {"none"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("vetoalg", {"none"}, -1, PUT));
} }
REQUIRE_THROWS(proxy.Call("vetoalg", {"dfgd"}, -1, GET)); REQUIRE_THROWS(proxy.Call("vetoalg", {"dfgd"}, -1, GET));

View File

@ -36,9 +36,13 @@ std::string ToString(const defs::dacIndex s);
std::string ToString(const std::vector<defs::dacIndex> &vec); std::string ToString(const std::vector<defs::dacIndex> &vec);
std::string ToString(const defs::burstMode s); std::string ToString(const defs::burstMode s);
std::string ToString(const defs::timingSourceType s); std::string ToString(const defs::timingSourceType s);
<<<<<<< HEAD
std::string ToString(const defs::M3_GainCaps s); std::string ToString(const defs::M3_GainCaps s);
std::string ToString(const defs::portPosition s); std::string ToString(const defs::portPosition s);
std::string ToString(const defs::ethernetInterface s); std::string ToString(const defs::ethernetInterface s);
=======
std::string ToString(const defs::streamingInterface s);
>>>>>>> 5.2.0-rc
std::string ToString(const defs::vetoAlgorithm s); std::string ToString(const defs::vetoAlgorithm s);
std::string ToString(const slsDetectorDefs::xy &coord); std::string ToString(const slsDetectorDefs::xy &coord);
@ -303,7 +307,7 @@ template <> defs::burstMode StringTo(const std::string &s);
template <> defs::timingSourceType StringTo(const std::string &s); template <> defs::timingSourceType StringTo(const std::string &s);
template <> defs::M3_GainCaps StringTo(const std::string &s); template <> defs::M3_GainCaps StringTo(const std::string &s);
template <> defs::portPosition StringTo(const std::string &s); template <> defs::portPosition StringTo(const std::string &s);
template <> defs::ethernetInterface StringTo(const std::string &s); template <> defs::streamingInterface StringTo(const std::string &s);
template <> defs::vetoAlgorithm StringTo(const std::string &s); template <> defs::vetoAlgorithm StringTo(const std::string &s);
template <> uint32_t StringTo(const std::string &s); template <> uint32_t StringTo(const std::string &s);

View File

@ -404,14 +404,14 @@ typedef struct {
enum portPosition { LEFT, RIGHT, TOP, BOTTOM }; enum portPosition { LEFT, RIGHT, TOP, BOTTOM };
#ifdef __cplusplus #ifdef __cplusplus
enum class ethernetInterface { enum class streamingInterface {
#else #else
enum ethernetInterface { enum streamingInterface {
#endif #endif
NONE = 0, NONE = 0,
I3GBE = 1 << 0, LOW_LATENCY_LINK = 1 << 0,
I10GBE = 1 << 1, ETHERNET_10GB = 1 << 1,
ALL = I3GBE | I10GBE ALL = LOW_LATENCY_LINK | ETHERNET_10GB
}; };
enum vetoAlgorithm { DEFAULT_ALGORITHM }; enum vetoAlgorithm { DEFAULT_ALGORITHM };
@ -509,17 +509,17 @@ typedef struct {
#ifdef __cplusplus #ifdef __cplusplus
}; };
inline slsDetectorDefs::ethernetInterface inline slsDetectorDefs::streamingInterface
operator|(const slsDetectorDefs::ethernetInterface &a, operator|(const slsDetectorDefs::streamingInterface &a,
const slsDetectorDefs::ethernetInterface &b) { const slsDetectorDefs::streamingInterface &b) {
return slsDetectorDefs::ethernetInterface(static_cast<int32_t>(a) | return slsDetectorDefs::streamingInterface(static_cast<int32_t>(a) |
static_cast<int32_t>(b)); static_cast<int32_t>(b));
}; };
inline slsDetectorDefs::ethernetInterface inline slsDetectorDefs::streamingInterface
operator&(const slsDetectorDefs::ethernetInterface &a, operator&(const slsDetectorDefs::streamingInterface &a,
const slsDetectorDefs::ethernetInterface &b) { const slsDetectorDefs::streamingInterface &b) {
return slsDetectorDefs::ethernetInterface(static_cast<int32_t>(a) & return slsDetectorDefs::streamingInterface(static_cast<int32_t>(a) &
static_cast<int32_t>(b)); static_cast<int32_t>(b));
}; };
#endif #endif

View File

@ -555,18 +555,18 @@ std::string ToString(const defs::portPosition s) {
} }
} }
std::string ToString(const defs::ethernetInterface s) { std::string ToString(const defs::streamingInterface s) {
std::ostringstream os; std::ostringstream os;
std::string rs; std::string rs;
switch (s) { switch (s) {
case defs::ethernetInterface::NONE: case defs::streamingInterface::NONE:
return std::string("none"); return std::string("none");
default: default:
if ((s & defs::ethernetInterface::I3GBE) != if ((s & defs::streamingInterface::LOW_LATENCY_LINK) !=
defs::ethernetInterface::NONE) defs::streamingInterface::NONE)
os << "3gbe, "; os << "lll, ";
if ((s & defs::ethernetInterface::I10GBE) != if ((s & defs::streamingInterface::ETHERNET_10GB) !=
defs::ethernetInterface::NONE) defs::streamingInterface::NONE)
os << "10gbe, "; os << "10gbe, ";
auto rs = os.str(); auto rs = os.str();
rs.erase(rs.end() - 2, rs.end()); rs.erase(rs.end() - 2, rs.end());
@ -951,17 +951,17 @@ template <> defs::portPosition StringTo(const std::string &s) {
throw sls::RuntimeError("Unknown port position " + s); throw sls::RuntimeError("Unknown port position " + s);
} }
template <> defs::ethernetInterface StringTo(const std::string &s) { template <> defs::streamingInterface StringTo(const std::string &s) {
std::string rs = s; std::string rs = s;
if (s.find(',') != std::string::npos) if (s.find(',') != std::string::npos)
rs.erase(rs.find(',')); rs.erase(rs.find(','));
if (rs == "none") if (rs == "none")
return defs::ethernetInterface::NONE; return defs::streamingInterface::NONE;
if (rs == "3gbe") if (rs == "lll")
return defs::ethernetInterface::I3GBE; return defs::streamingInterface::LOW_LATENCY_LINK;
if (rs == "10gbe") if (rs == "10gbe")
return defs::ethernetInterface::I10GBE; return defs::streamingInterface::ETHERNET_10GB;
throw sls::RuntimeError("Unknown ethernetInterface type " + s); throw sls::RuntimeError("Unknown streamingInterface type " + s);
} }
template <> defs::vetoAlgorithm StringTo(const std::string &s) { template <> defs::vetoAlgorithm StringTo(const std::string &s) {

View File

@ -324,10 +324,10 @@ TEST_CASE("Print a member of patternParameters") {
REQUIRE(ToString(pat->limits) == "[4, 100]"); REQUIRE(ToString(pat->limits) == "[4, 100]");
} }
TEST_CASE("ethernetInterface") { TEST_CASE("streamingInterface") {
REQUIRE(ToString(sls::defs::ethernetInterface::NONE) == "none"); REQUIRE(ToString(sls::defs::streamingInterface::NONE) == "none");
REQUIRE(ToString(sls::defs::ethernetInterface::I10GBE) == "10gbe"); REQUIRE(ToString(sls::defs::streamingInterface::ETHERNET_10GB) == "10gbe");
REQUIRE(ToString(sls::defs::ethernetInterface::I3GBE) == "3gbe"); REQUIRE(ToString(sls::defs::streamingInterface::LOW_LATENCY_LINK) == "lll");
REQUIRE(ToString(sls::defs::ethernetInterface::I3GBE | REQUIRE(ToString(sls::defs::streamingInterface::LOW_LATENCY_LINK |
sls::defs::ethernetInterface::I10GBE) == "3gbe, 10gbe"); sls::defs::streamingInterface::ETHERNET_10GB) == "lll, 10gbe");
} }