mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 17:18:00 +02:00
Merge pull request #127 from slsdetectorgroup/configuremac
Configuremac
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -151,7 +151,7 @@ int get_read_n_lines(int);
|
||||
void calculate_and_set_position();
|
||||
int set_detector_position(int);
|
||||
int check_detector_idle();
|
||||
int is_configurable();
|
||||
int is_udp_configured();
|
||||
void configure_mac();
|
||||
int set_source_udp_ip(int);
|
||||
int get_source_udp_ip(int);
|
||||
@ -237,3 +237,5 @@ int get_adc_config(int);
|
||||
int set_adc_config(int);
|
||||
int get_bad_channels(int);
|
||||
int set_bad_channels(int);
|
||||
int reconfigure_udp(int);
|
||||
int validate_udp_configuration(int);
|
@ -354,6 +354,8 @@ void function_table() {
|
||||
flist[F_SET_ADC_CONFIGURATION] = &set_adc_config;
|
||||
flist[F_GET_BAD_CHANNELS] = &get_bad_channels;
|
||||
flist[F_SET_BAD_CHANNELS] = &set_bad_channels;
|
||||
flist[F_RECONFIGURE_UDP] = &reconfigure_udp;
|
||||
flist[F_VALIDATE_UDP_CONFIG] = &validate_udp_configuration;
|
||||
|
||||
// check
|
||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||
@ -4864,14 +4866,14 @@ int check_detector_idle() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int is_configurable() {
|
||||
if (udpDetails.srcip == 0) {
|
||||
strcpy(configureMessage, "udp source ip not configured\n");
|
||||
int is_udp_configured() {
|
||||
if (udpDetails.dstip == 0) {
|
||||
strcpy(configureMessage, "udp destination ip not configured\n");
|
||||
LOG(logWARNING, ("%s", configureMessage));
|
||||
return FAIL;
|
||||
}
|
||||
if (udpDetails.dstip == 0) {
|
||||
strcpy(configureMessage, "udp destination ip not configured\n");
|
||||
if (udpDetails.srcip == 0) {
|
||||
strcpy(configureMessage, "udp source ip not configured\n");
|
||||
LOG(logWARNING, ("%s", configureMessage));
|
||||
return FAIL;
|
||||
}
|
||||
@ -4913,7 +4915,7 @@ int is_configurable() {
|
||||
}
|
||||
|
||||
void configure_mac() {
|
||||
if (is_configurable() == OK) {
|
||||
if (is_udp_configured() == OK) {
|
||||
ret = configureMAC();
|
||||
if (ret != OK) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
@ -7391,7 +7393,7 @@ int set_veto(int file_des) {
|
||||
setVeto(arg);
|
||||
// if numinterfaces is 2 and veto is 1 now, then configuremac
|
||||
if (arg > 0 && getNumberofUDPInterfaces() == 2 &&
|
||||
is_configurable() == OK) {
|
||||
is_udp_configured() == OK) {
|
||||
ret = configureMAC();
|
||||
if (ret != OK) {
|
||||
sprintf(mess, "Configure Mac failed after enabling veto\n");
|
||||
@ -7976,3 +7978,37 @@ int set_bad_channels(int file_des) {
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
||||
int reconfigure_udp(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
if (Server_VerifyLock() == OK) {
|
||||
LOG(logINFO, ("Reconfiguring UDP\n"));
|
||||
if (check_detector_idle() == OK) {
|
||||
configure_mac();
|
||||
if (configured == FAIL) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Invalid UDP Configuration because ");
|
||||
strcat(mess, configureMessage);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
||||
int validate_udp_configuration(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
LOG(logINFO, ("Validating UDP Configuration\n"));
|
||||
if (configured == FAIL) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Invalid UDP Configuration because ");
|
||||
strcat(mess, configureMessage);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
@ -509,6 +509,10 @@ class Detector {
|
||||
*/
|
||||
void setDestinationUDPPort2(int port, int module_id = -1);
|
||||
|
||||
void reconfigureUDPDestination(Positions pos = {});
|
||||
|
||||
void validateUDPConfiguration(Positions pos = {});
|
||||
|
||||
Result<std::string> printRxConfiguration(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger][CTB][Moench][Mythen3] */
|
||||
|
@ -776,6 +776,8 @@ class CmdProxy {
|
||||
{"udp_dstmac2", &CmdProxy::udp_dstmac2},
|
||||
{"udp_dstport", &CmdProxy::udp_dstport},
|
||||
{"udp_dstport2", &CmdProxy::udp_dstport2},
|
||||
{"udp_reconfigure", &CmdProxy::udp_reconfigure},
|
||||
{"udp_validate", &CmdProxy::udp_validate},
|
||||
{"rx_printconfig", &CmdProxy::rx_printconfig},
|
||||
{"tengiga", &CmdProxy::tengiga},
|
||||
{"flowcontrol10g", &CmdProxy::flowcontrol10g},
|
||||
@ -1645,6 +1647,18 @@ class CmdProxy {
|
||||
"sent to. \n[Eiger] Port number of the reciever (desintation) udp "
|
||||
"interface where the right half of the detector data is sent to.");
|
||||
|
||||
EXECUTE_SET_COMMAND(
|
||||
udp_reconfigure, reconfigureUDPDestination,
|
||||
"\n\tReconfigures Detector with UDP destination. More for debugging as "
|
||||
"the configuration is done automatically when the detector has "
|
||||
"sufficient UDP details.");
|
||||
|
||||
EXECUTE_SET_COMMAND(
|
||||
udp_validate, validateUDPConfiguration,
|
||||
"\n\tValidates that UDP configuration in the detector is "
|
||||
"valid. If not configured, it will throw with error message "
|
||||
"requesting missing udp information.");
|
||||
|
||||
GET_COMMAND(rx_printconfig, printRxConfiguration,
|
||||
"\n\tPrints the receiver configuration.");
|
||||
|
||||
|
@ -716,6 +716,14 @@ void Detector::setDestinationUDPPort2(int port, int module_id) {
|
||||
}
|
||||
}
|
||||
|
||||
void Detector::reconfigureUDPDestination(Positions pos) {
|
||||
pimpl->Parallel(&Module::reconfigureUDPDestination, pos);
|
||||
}
|
||||
|
||||
void Detector::validateUDPConfiguration(Positions pos) {
|
||||
pimpl->Parallel(&Module::validateUDPConfiguration, pos);
|
||||
}
|
||||
|
||||
Result<std::string> Detector::printRxConfiguration(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::printReceiverConfiguration, pos);
|
||||
}
|
||||
|
@ -638,6 +638,12 @@ void Module::setDestinationUDPPort2(const int port) {
|
||||
}
|
||||
}
|
||||
|
||||
void Module::reconfigureUDPDestination() { sendToDetector(F_RECONFIGURE_UDP); }
|
||||
|
||||
void Module::validateUDPConfiguration() {
|
||||
sendToDetector(F_VALIDATE_UDP_CONFIG);
|
||||
}
|
||||
|
||||
std::string Module::printReceiverConfiguration() {
|
||||
std::ostringstream os;
|
||||
os << "\n\nDetector " << moduleId << "\nReceiver Hostname:\t"
|
||||
|
@ -202,6 +202,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setDestinationUDPPort(int udpport);
|
||||
int getDestinationUDPPort2() const;
|
||||
void setDestinationUDPPort2(int udpport);
|
||||
void reconfigureUDPDestination();
|
||||
void validateUDPConfiguration();
|
||||
std::string printReceiverConfiguration();
|
||||
bool getTenGiga() const;
|
||||
void setTenGiga(bool value);
|
||||
|
@ -1311,10 +1311,10 @@ TEST_CASE("scan", "[.cmd][.new]") {
|
||||
CHECK_THROWS(proxy.Call(
|
||||
"scan", {sls::ToString(notImplementedInd), "500", "1500", "500"}, -1,
|
||||
PUT));
|
||||
CHECK_THROWS(proxy.Call(
|
||||
"scan", {sls::ToString(ind), "500", "1500", "-500"}, -1, PUT));
|
||||
CHECK_THROWS(proxy.Call(
|
||||
"scan", {sls::ToString(ind), "1500", "500", "500"}, -1, PUT));
|
||||
CHECK_THROWS(proxy.Call("scan", {sls::ToString(ind), "500", "1500", "-500"},
|
||||
-1, PUT));
|
||||
CHECK_THROWS(proxy.Call("scan", {sls::ToString(ind), "1500", "500", "500"},
|
||||
-1, PUT));
|
||||
|
||||
if (det_type == defs::MYTHEN3 || defs::EIGER) {
|
||||
{
|
||||
@ -1332,7 +1332,7 @@ TEST_CASE("scan", "[.cmd][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
//Switch off scan for future tests
|
||||
// Switch off scan for future tests
|
||||
det.setScan(defs::scanParameters());
|
||||
// acquire for each?
|
||||
|
||||
@ -1562,6 +1562,20 @@ TEST_CASE("udp_dstport2", "[.cmd][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("udp_reconfigure", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
REQUIRE_THROWS(proxy.Call("udp_reconfigure", {}, -1, GET));
|
||||
REQUIRE_NOTHROW(proxy.Call("udp_reconfigure", {}, -1, PUT));
|
||||
}
|
||||
|
||||
TEST_CASE("udp_validate", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
REQUIRE_THROWS(proxy.Call("udp_validate", {}, -1, GET));
|
||||
REQUIRE_NOTHROW(proxy.Call("udp_validate", {}, -1, PUT));
|
||||
}
|
||||
|
||||
TEST_CASE("tengiga", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
@ -211,6 +211,8 @@ enum detFuncs {
|
||||
F_SET_ADC_CONFIGURATION,
|
||||
F_GET_BAD_CHANNELS,
|
||||
F_SET_BAD_CHANNELS,
|
||||
F_RECONFIGURE_UDP,
|
||||
F_VALIDATE_UDP_CONFIG,
|
||||
|
||||
NUM_DET_FUNCTIONS,
|
||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
||||
@ -523,6 +525,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_GET_ADC_CONFIGURATION: return "F_GET_ADC_CONFIGURATION";
|
||||
case F_GET_BAD_CHANNELS: return "F_GET_BAD_CHANNELS";
|
||||
case F_SET_BAD_CHANNELS: return "F_SET_BAD_CHANNELS";
|
||||
case F_RECONFIGURE_UDP: return "F_RECONFIGURE_UDP";
|
||||
case F_VALIDATE_UDP_CONFIG: return "F_VALIDATE_UDP_CONFIG";
|
||||
|
||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||
|
@ -3,10 +3,10 @@
|
||||
#define APILIB 0x200409
|
||||
#define APIRECEIVER 0x200409
|
||||
#define APIGUI 0x200409
|
||||
#define APIEIGER 0x200729
|
||||
#define APICTB 0x200729
|
||||
#define APIGOTTHARD 0x200729
|
||||
#define APIJUNGFRAU 0x200729
|
||||
#define APIMOENCH 0x200729
|
||||
#define APIGOTTHARD2 0x200730
|
||||
#define APIMYTHEN3 0x200804
|
||||
#define APICTB 0x200805
|
||||
#define APIGOTTHARD 0x200805
|
||||
#define APIGOTTHARD2 0x200805
|
||||
#define APIJUNGFRAU 0x200805
|
||||
#define APIMYTHEN3 0x200805
|
||||
#define APIMOENCH 0x200804
|
||||
#define APIEIGER 0x200805
|
||||
|
Reference in New Issue
Block a user