diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer index 31b41c248..c4aaa97ce 100755 Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ diff --git a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer index 0feebcefb..50f115276 100755 Binary files a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer and b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer differ diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer index 3ed118b26..4f5ede4d4 100755 Binary files a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer differ diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index 8c45ae8ed..17d5175bc 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -472,6 +472,12 @@ void setupDetector() { // power on chip powerChip(1); + // default asic value (masks? what do they mean? TODO) + bus_w(ASIC_CONFIG_REG, DEFAULT_ASIC_CONFIG_VALUE); + + setPhase(READOUT_C1, DEFAULT_CLK1_PHASE_DEG, 1); + setDBITPipeline(DEFAULT_DBIT_PIPELINE); + // also sets default dac and on chip dac values if (readConfigFile() == FAIL) { return; diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h index 2cc45638f..c84b10e03 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h @@ -52,8 +52,8 @@ #define DEFAULT_TIMING_SOURCE (TIMING_INTERNAL) #define DEFAULT_ALGORITHM (ALG_HITS) -#define DEFAULT_READOUT_C0 (6) //(144444448) // rdo_clk, 144 MHz -#define DEFAULT_READOUT_C1 (6) //(144444448) // rdo_x2_clk, 144 MHz +#define DEFAULT_READOUT_C0 (8) //(108333336) // rdo_clk, 144 MHz +#define DEFAULT_READOUT_C1 (8) //(108333336) // rdo_x2_clk, 144 MHz #define DEFAULT_SYSTEM_C0 (5) //(144444448) // run_clk, 144 MHz #define DEFAULT_SYSTEM_C1 (10) //(72222224) // chip_clk, 72 MHz #define DEFAULT_SYSTEM_C2 (5) //(144444448) // sync_clk, 144 MHz @@ -65,6 +65,10 @@ #define READOUT_PLL_VCO_FREQ_HZ (866666688) // 866 MHz #define SYSTEM_PLL_VCO_FREQ_HZ (722222224) // 722 MHz +#define DEFAULT_CLK1_PHASE_DEG (270) +#define DEFAULT_DBIT_PIPELINE (1) +#define DEFAULT_ASIC_CONFIG_VALUE (0x80350000) + #define VETO_DATA_SIZE (160) typedef struct { uint64_t frameNumber; diff --git a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer index 750a303bf..7c4f1e21a 100755 Binary files a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer and b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer differ diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer index a358b9e2f..f7f48871c 100755 Binary files a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer differ diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h index 36454c925..04aabe1da 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h @@ -67,9 +67,9 @@ enum DACINDEX { #define NSPECIALDACS (3) #define SPECIALDACINDEX {J_VREF_PRECH, J_VREF_DS, J_VREF_COMP}; #define SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS \ - { 1000, 500, 400 } + { 1450, 480, 420 } #define SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS \ - { 1500, 550, 450 } + { 1450, 480, 420 } enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G }; enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS }; diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer index 6adc29539..e56a97196 100755 Binary files a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer differ diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer index e8029cf00..932f13252 100755 Binary files a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer differ diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h index da20ee922..14df33e2b 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h @@ -271,6 +271,6 @@ int get_module_id(int); int get_dest_udp_list(int); int set_dest_udp_list(int); int get_num_dest_list(int); -int set_num_dest_list(int); +int clear_all_udp_dst(int); int get_udp_first_dest(int); int set_udp_first_dest(int); \ No newline at end of file diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index a72e05980..a3936c5e8 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -408,7 +408,7 @@ void function_table() { flist[F_GET_DEST_UDP_LIST] = &get_dest_udp_list; flist[F_SET_DEST_UDP_LIST] = &set_dest_udp_list; flist[F_GET_NUM_DEST_UDP] = &get_num_dest_list; - flist[F_SET_NUM_DEST_UDP] = &set_num_dest_list; + flist[F_CLEAR_ALL_UDP_DEST] = &clear_all_udp_dst; flist[F_GET_UDP_FIRST_DEST] = &get_udp_first_dest; flist[F_SET_UDP_FIRST_DEST] = &set_udp_first_dest; @@ -9198,7 +9198,32 @@ int set_dest_udp_list(int file_des) { } } } - configure_mac(); + // find number of destinations + int numdest = 0; + for (int i = MAX_UDP_DESTINATION; i >= 0; --i) { + if (udpDetails[i].dstip != 0) { + numdest = i + 1; + break; + } + } + // atleast 1 destination + if (numdest == 0) { + numdest = 1; + } + // set number of destinations +#if defined(JUNGFRAUD) || defined(EIGERD) + if (setNumberofDestinations(numdest) == FAIL) { + ret = FAIL; + strcpy(mess, "Could not set number of udp destinations.\n"); + LOG(logERROR, (mess)); + } else +#endif + { + numUdpDestinations = numdest; + LOG(logINFOBLUE, ("Number of UDP Destinations: %d\n", + numUdpDestinations)); + configure_mac(); + } } } } @@ -9210,10 +9235,13 @@ int get_num_dest_list(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); int retval = -1; + #if !defined(JUNGFRAUD) && !defined(EIGERD) functionNotImplemented(); #else retval = numUdpDestinations; + LOG(logDEBUG1, ("numUdpDestinations retval: 0x%x\n", retval)); + int retval1 = 0; if (getNumberofDestinations(&retval1) == FAIL || retval1 != retval) { ret = FAIL; @@ -9223,42 +9251,23 @@ int get_num_dest_list(int file_des) { LOG(logERROR, (mess)); } #endif - LOG(logDEBUG1, ("numUdpDestinations retval: 0x%x\n", retval)); + return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); } -int set_num_dest_list(int file_des) { +int clear_all_udp_dst(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - int arg = -1; - if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) - return printSocketReadError(); - LOG(logDEBUG1, ("Setting number of udp destinations to %d\n", arg)); - -#if !defined(JUNGFRAUD) && !defined(EIGERD) - functionNotImplemented(); -#else - if (arg < 1 || arg > MAX_UDP_DESTINATION) { - ret = FAIL; - sprintf(mess, - "Could not set number of udp destinations. Options: 1-%d\n", - MAX_UDP_DESTINATION); - LOG(logERROR, (mess)); - } else { - if (check_detector_idle("set number of udp destinations") == OK) { - if (setNumberofDestinations(arg) == FAIL) { - ret = FAIL; - strcpy(mess, - "Could not set number of udp destinations.\n"); - LOG(logERROR, (mess)); - } else { - numUdpDestinations = arg; - configure_mac(); - } + LOG(logINFO, ("Clearing all udp destinations\n")); + if (Server_VerifyLock() == OK) { + if (check_detector_idle("clear all udp destinations") == OK) { + memset(udpDetails, 0, sizeof(udpDetails)); + // minimum 1 destination in fpga + numUdpDestinations = 1; + configure_mac(); } } -#endif return Server_SendResult(file_des, INT32, NULL, 0); } @@ -9295,19 +9304,22 @@ int set_udp_first_dest(int file_des) { #ifndef JUNGFRAUD functionNotImplemented(); #else - if (arg < 0 || arg >= numUdpDestinations) { - ret = FAIL; - sprintf(mess, "Could not set first destination. Options: 0-%d\n", - numUdpDestinations - 1); - LOG(logERROR, (mess)); - } else { - if (check_detector_idle("set first udp destination") == OK) { - setFirstUDPDestination(arg); - int retval = getFirstUDPDestination(); - validate(&ret, mess, arg, retval, "set udp first destination", DEC); - if (ret == OK) { - firstUDPDestination = arg; - //configure_mac(); + // only set + if (Server_VerifyLock() == OK) { + if (arg < 0 || arg >= numUdpDestinations) { + ret = FAIL; + sprintf(mess, "Could not set first destination. Options: 0-%d\n", + numUdpDestinations - 1); + LOG(logERROR, (mess)); + } else { + if (check_detector_idle("set first udp destination") == OK) { + setFirstUDPDestination(arg); + int retval = getFirstUDPDestination(); + validate(&ret, mess, arg, retval, "set udp first destination", DEC); + if (ret == OK) { + firstUDPDestination = arg; + //configure_mac(); + } } } } diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index f60b615c0..a92a7087b 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -671,8 +671,7 @@ class Detector { /** [Jungfrau][Eiger] */ Result getNumberofUDPDestinations(Positions pos = {}) const; - /**[Jungfrau][Eiger] Options 1-32 */ - void setNumberofUDPDestinations(const int value, Positions pos = {}); + void clearUDPDestinations(Positions pos = {}); /** [Jungfrau] */ Result getFirstUDPDestination(Positions pos = {}) const; diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index 5e172d16d..081197f49 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -861,6 +861,7 @@ class CmdProxy { {"selinterface", &CmdProxy::selinterface}, {"udp_dstlist", &CmdProxy::UDPDestinationList}, {"udp_numdst", &CmdProxy::udp_numdst}, + {"udp_cleardst", &CmdProxy::udp_cleardst}, {"udp_firstdst", &CmdProxy::udp_firstdst}, {"udp_srcip", &CmdProxy::udp_srcip}, {"udp_srcip2", &CmdProxy::udp_srcip2}, @@ -1537,11 +1538,13 @@ class CmdProxy { "[0, 1]\n\t[Jungfrau] The udp interface to stream data from detector. " "Effective only when number of interfaces is 1. Default: 0 (outer)"); - INTEGER_COMMAND_VEC_ID(udp_numdst, getNumberofUDPDestinations, - setNumberofUDPDestinations, StringTo, - "[1 - 32]\n\t[Jungfrau][Eiger] One can set upto 32 " + GET_COMMAND(udp_numdst, getNumberofUDPDestinations, + "\n\t[Jungfrau][Eiger] One can enter upto 32 " "destinations that the detector will stream images " - "out in a round robin fashion. Default: 1"); + "out in a round robin fashion. This is get only command. Default: 1"); + + EXECUTE_SET_COMMAND(udp_cleardst, clearUDPDestinations, + "\n\tClears udp destination details on the detector."); INTEGER_COMMAND_VEC_ID( udp_firstdst, getFirstUDPDestination, setFirstUDPDestination, diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index a1654ab59..65cf32fae 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -921,8 +921,8 @@ Result Detector::getNumberofUDPDestinations(Positions pos) const { return pimpl->Parallel(&Module::getNumberofUDPDestinations, pos); } -void Detector::setNumberofUDPDestinations(const int value, Positions pos) { - pimpl->Parallel(&Module::setNumberofUDPDestinations, pos, value); +void Detector::clearUDPDestinations(Positions pos) { + pimpl->Parallel(&Module::clearUDPDestinations, pos); } Result Detector::getFirstUDPDestination(Positions pos) const { diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 907ce0575..4f4038803 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -970,9 +970,7 @@ int Module::getNumberofUDPDestinations() const { return sendToDetector(F_GET_NUM_DEST_UDP); } -void Module::setNumberofUDPDestinations(const int value) { - sendToDetector(F_SET_NUM_DEST_UDP, value, nullptr); -} +void Module::clearUDPDestinations() { sendToDetector(F_CLEAR_ALL_UDP_DEST); } int Module::getFirstUDPDestination() const { return sendToDetector(F_GET_UDP_FIRST_DEST); diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index 49a2e2593..f33e981eb 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -224,7 +224,7 @@ class Module : public virtual slsDetectorDefs { sls::UdpDestination getDestinationUDPList(const uint32_t entry) const; void setDestinationUDPList(const sls::UdpDestination dest); int getNumberofUDPDestinations() const; - void setNumberofUDPDestinations(const int value); + void clearUDPDestinations(); int getFirstUDPDestination() const; void setFirstUDPDestination(const int value); sls::IpAddr getDestinationUDPIP() const; diff --git a/slsDetectorSoftware/tests/test-CmdProxy.cpp b/slsDetectorSoftware/tests/test-CmdProxy.cpp index 0fdeaccec..5351f5570 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy.cpp @@ -2229,33 +2229,20 @@ TEST_CASE("udp_numdst", "[.cmd]") { CmdProxy proxy(&det); auto det_type = det.getDetectorType().squash(); if (det_type == defs::JUNGFRAU || det_type == defs::EIGER) { - auto prev_val = det.getNumberofUDPDestinations(); - { - std::ostringstream oss; - proxy.Call("udp_numdst", {"10"}, -1, PUT, oss); - REQUIRE(oss.str() == "udp_numdst 10\n"); - } - { - std::ostringstream oss; - proxy.Call("udp_numdst", {}, -1, GET, oss); - REQUIRE(oss.str() == "udp_numdst 10\n"); - } - { - std::ostringstream oss; - proxy.Call("udp_numdst", {"32"}, -1, PUT, oss); - REQUIRE(oss.str() == "udp_numdst 32\n"); - } - REQUIRE_THROWS(proxy.Call("udp_numdst", {"0"}, -1, PUT)); - REQUIRE_THROWS(proxy.Call("udp_numdst", {"33"}, -1, PUT)); - - for (int i = 0; i != det.size(); ++i) { - det.setNumberofUDPDestinations(prev_val[i], {i}); - } + REQUIRE_NOTHROW(proxy.Call("udp_numdst", {}, -1, GET)); } else { REQUIRE_THROWS(proxy.Call("udp_numdst", {}, -1, GET)); } } + +TEST_CASE("udp_cleardst", "[.cmd]") { + Detector det; + CmdProxy proxy(&det); + REQUIRE_THROWS(proxy.Call("udp_cleardst", {}, -1, GET)); + REQUIRE_NOTHROW(proxy.Call("udp_cleardst", {}, -1, PUT)); +} + TEST_CASE("udp_firstdst", "[.cmd]") { Detector det; CmdProxy proxy(&det); diff --git a/slsSupportLib/include/sls/sls_detector_funcs.h b/slsSupportLib/include/sls/sls_detector_funcs.h index 4a4fd8f61..cd0fe477e 100755 --- a/slsSupportLib/include/sls/sls_detector_funcs.h +++ b/slsSupportLib/include/sls/sls_detector_funcs.h @@ -247,7 +247,7 @@ enum detFuncs { F_GET_DEST_UDP_LIST, F_SET_DEST_UDP_LIST, F_GET_NUM_DEST_UDP, - F_SET_NUM_DEST_UDP, + F_CLEAR_ALL_UDP_DEST, F_GET_UDP_FIRST_DEST, F_SET_UDP_FIRST_DEST, @@ -604,7 +604,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) { case F_GET_DEST_UDP_LIST: return "F_GET_DEST_UDP_LIST"; case F_SET_DEST_UDP_LIST: return "F_SET_DEST_UDP_LIST"; case F_GET_NUM_DEST_UDP: return "F_GET_NUM_DEST_UDP"; - case F_SET_NUM_DEST_UDP: return "F_SET_NUM_DEST_UDP"; + case F_CLEAR_ALL_UDP_DEST: return "F_CLEAR_ALL_UDP_DEST"; case F_GET_UDP_FIRST_DEST: return "F_GET_UDP_FIRST_DEST"; case F_SET_UDP_FIRST_DEST: return "F_SET_UDP_FIRST_DEST"; diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 4e169318a..df90dfd44 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -1,13 +1,13 @@ /** API versions */ -#define GITBRANCH "roundrobin" -#define APILIB 0x210831 -#define APIRECEIVER 0x210831 -#define APIGUI 0x210819 +#define GITBRANCH "udp_numdst" + #define APICTB 0x210917 #define APIGOTTHARD 0x210917 #define APIGOTTHARD2 0x210917 -#define APIMYTHEN3 0x210917 -#define APIMOENCH 0x210916 -#define APIEIGER 0x210917 - #define APIJUNGFRAU 0x210917 +#define APIMYTHEN3 0x210917 +#define APIMOENCH 0x210917 +#define APIEIGER 0x210917 +#define APILIB 0x210917 +#define APIRECEIVER 0x210917 +#define APIGUI 0x210819