diff --git a/RELEASE.txt b/RELEASE.txt index 92ddc5c29..191012b66 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -29,7 +29,8 @@ This document describes the differences between v7.x.x and v7.0.0 - moench being made compatible with jungfrau 2.0 boards (jungfrau structure, away from ctb) -- eiger febl and feb in versions +- eiger febl and febr in versions, ensure its the same as beb fw version +- eiger hardware version fx30 and fx70 (versions command) - fixed rx_arping error - fix hdf5 compilation (detspec fields) diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index d3dc29377..803faee77 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -230,7 +230,8 @@ class Detector(CppDetectorApi): @element def hardwareversion(self): """ - [Jungfrau][Moench][Gotthard2][Myhten3][Gotthard][Ctb] Hardware version of detector. + [Jungfrau][Moench][Gotthard2][Myhten3][Gotthard][Ctb] Hardware version of detector. \n + [Eiger] Hardware version of front FPGA on detector. """ return self.getHardwareVersion() @@ -1890,17 +1891,18 @@ class Detector(CppDetectorApi): def versions(self): version_list = {'type': self.type, 'package': self.packageversion, - 'client': self.clientversion, - 'detectorserver': self.detectorserverversion, - 'kernel': self.kernelversion} - + 'client': self.clientversion} + if self.type == detectorType.EIGER: version_list ['firmware (Beb)'] = self.firmwareversion version_list ['firmware(Febl)'] = self.getFrontEndFirmwareVersion(slsDetectorDefs.fpgaPosition.FRONT_LEFT) version_list ['firmware (Febr)'] = self.getFrontEndFirmwareVersion(slsDetectorDefs.fpgaPosition.FRONT_RIGHT) else: version_list ['firmware'] = self.firmwareversion - version_list ['hardware'] = self.hardwareversion + + version_list ['detectorserver'] = self.detectorserverversion + version_list ['kernel'] = self.kernelversion + version_list ['hardware'] = self.hardwareversion if self.use_receiver: version_list ['receiver'] = self.rx_version diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.c b/slsDetectorServers/eigerDetectorServer/FebControl.c index c10aa881f..075942063 100644 --- a/slsDetectorServers/eigerDetectorServer/FebControl.c +++ b/slsDetectorServers/eigerDetectorServer/FebControl.c @@ -1742,6 +1742,7 @@ int Feb_Control_WriteRegister_BitMask(uint32_t offset, uint32_t data, int Feb_Control_ReadRegister_BitMask(uint32_t offset, uint32_t *retval, uint32_t bitmask) { + uint32_t actualOffset = offset; char side[2][10] = {"right", "left"}; unsigned int addr[2] = {Feb_Control_rightAddress, Feb_Control_leftAddress}; @@ -2206,6 +2207,21 @@ int Feb_Control_GetRightFPGATemp() { return (int)temperature; } +int Feb_Control_GetFPGAHardwareVersion(int *retval) { + if (!Feb_Control_activated) { + return 0; + } + unsigned int value = 0; + if (!Feb_Control_ReadRegister_BitMask(FEB_REG_STATUS, &value, + FEB_REG_STATUS_FX30_MSK)) { + LOG(logERROR, + ("Trouble reading FEB_REG_STATUS reg to feb hardware version\n")); + return 0; + } + *retval = (value >> FEB_REG_STATUS_FX30_OFST); + return 1; +} + int64_t Feb_Control_GetFrontLeftFirmwareVersion() { if (!Feb_Control_activated) { return 0; diff --git a/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h b/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h index 1e95ef327..b1246db33 100644 --- a/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h +++ b/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h @@ -46,6 +46,8 @@ #define FEB_REG_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << FEB_REG_STATUS_WAIT_FOR_TRGGR_OFST) #define FEB_REG_STATUS_ACQ_DONE_OFST (6) #define FEB_REG_STATUS_ACQ_DONE_MSK (0x00000001 << FEB_REG_STATUS_ACQ_DONE_OFST) +#define FEB_REG_STATUS_FX30_OFST (7) +#define FEB_REG_STATUS_FX30_MSK (0x00000001 << FEB_REG_STATUS_FX30_OFST) #define FEB_REG_STATUS_FW_VERSION_OFST (8) #define FEB_REG_STATUS_FW_VERSION_MSK (0x000000FF << FEB_REG_STATUS_FW_VERSION_OFST) #define FEB_REG_STATUS_TEMP_OFST (16) diff --git a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer index dca92b80a..3f8418bcb 100755 Binary files a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer and b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer differ diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c index 6d0ec7eb2..06771b537 100644 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c @@ -123,18 +123,18 @@ void basictests() { int64_t sw_fw_apiversion = getFirmwareAPIVersion(); LOG(logINFOBLUE, - ("**************************************************\n" - "Detector IP Addr:\t\t 0x%x\n" - "Detector MAC Addr:\t\t 0x%llx\n" + ("\n********************************************************\n" + "Detector IP Addr : 0x%x\n" + "Detector MAC Addr : 0x%llx\n" - "Firmware Version:\t\t %lld\n" - "Software Version:\t\t %s\n" - "F/w-S/w API Version:\t\t %lld\n" - "Required Firmware Version:\t %d\n" + "Firmware (Beb) Version : %lld\n" + "F/w-S/w API Version : %lld\n" + "Required Firmware Version: %d\n" + "Software Version : %s\n" "********************************************************\n", (unsigned int)ipadd, (long long unsigned int)macadd, - (long long int)fwversion, swversion, (long long int)sw_fw_apiversion, - REQUIRED_FIRMWARE_VERSION)); + (long long int)fwversion, + (long long int)sw_fw_apiversion, REQUIRED_FIRMWARE_VERSION, swversion)); // update default udpdstip and udpdstmac (1g is hardware ip and hardware // mac) @@ -161,9 +161,9 @@ void basictests() { // check for API compatibility - old server if (sw_fw_apiversion > REQUIRED_FIRMWARE_VERSION) { sprintf(initErrorMessage, - "This firmware-software api version (0x%llx) is incompatible " + "This firmware-software api version (0x%lld) is incompatible " "with the software's minimum required firmware version " - "(0x%llx).\nPlease update detector software to be compatible " + "(0x%lld).\nPlease update detector software to be compatible " "with this firmware.\n", (long long int)sw_fw_apiversion, (long long int)REQUIRED_FIRMWARE_VERSION); @@ -210,7 +210,7 @@ void getServerVersion(char *version) { strcpy(version, APIEIGER); } u_int64_t getFirmwareVersion() { #ifdef VIRTUAL - return 0; + return REQUIRED_FIRMWARE_VERSION; #else return Beb_GetFirmwareRevision(); #endif @@ -218,7 +218,9 @@ u_int64_t getFirmwareVersion() { uint64_t getFrontEndFirmwareVersion(enum fpgaPosition fpgaPosition) { uint64_t retval = 0; -#ifndef VIRTUAL +#ifdef VIRTUAL + return REQUIRED_FIRMWARE_VERSION; +#else sharedMemory_lockLocalLink(); switch (fpgaPosition) { case FRONT_LEFT: @@ -230,7 +232,7 @@ uint64_t getFrontEndFirmwareVersion(enum fpgaPosition fpgaPosition) { default: LOG(logERROR, ("unknown index for fpga position to read firmware version\n")); - retval = -1; + retval = 0; } sharedMemory_unlockLocalLink(); #endif @@ -239,12 +241,39 @@ uint64_t getFrontEndFirmwareVersion(enum fpgaPosition fpgaPosition) { u_int64_t getFirmwareAPIVersion() { #ifdef VIRTUAL - return 0; + return REQUIRED_FIRMWARE_VERSION; #else - return (u_int64_t)Beb_GetFirmwareSoftwareAPIVersion(); + return Beb_GetFirmwareSoftwareAPIVersion(); #endif } +void getHardwareVersion(char *version) { + strcpy(version, "unknown"); + int hwversion = getHardwareVersionNumber(); + const int hwNumberList[] = HARDWARE_VERSION_NUMBERS; + const char *hwNamesList[] = HARDWARE_VERSION_NAMES; + for (int i = 0; i != NUM_HARDWARE_VERSIONS; ++i) { + LOG(logDEBUG, ("0x%x %d 0x%x %s\n", hwversion, i, hwNumberList[i], + hwNamesList[i])); + if (hwNumberList[i] == hwversion) { + strcpy(version, hwNamesList[i]); + return; + } + } +} + +int getHardwareVersionNumber() { + int retval = 0; +#ifndef VIRTUAL + sharedMemory_lockLocalLink(); + if (!Feb_Control_GetFPGAHardwareVersion(&retval)) { + retval = -1; + } + sharedMemory_unlockLocalLink(); +#endif + return retval; +} + int getModuleId(int *ret, char *mess) { return getModuleIdInFile(ret, mess, ID_FILE); } @@ -376,6 +405,36 @@ void initControlServer() { Beb_SetTopVariable(top); Beb_Beb(); LOG(logDEBUG1, ("Control server: BEB Initialization done\n")); + + // Getting the feb versions after initialization + char hversion[MAX_STR_LENGTH] = {0}; + memset(hversion, 0, MAX_STR_LENGTH); + getHardwareVersion(hversion); + int64_t fwversion = getFirmwareVersion(); + int64_t feblfwversion = getFrontEndFirmwareVersion(FRONT_LEFT); + int64_t febrfwversion = getFrontEndFirmwareVersion(FRONT_RIGHT); + LOG(logINFOBLUE, + ("\n********************************************************\n" + "Feb Versions\n" + "Hardware Version : %s\n" + "Firmware (Febl) Version : %lld\n" + "Firmware (Febr) Version : %lld\n" + "********************************************************\n", + hversion, (long long int)feblfwversion, + (long long int)febrfwversion)); + + // ensure febl, febr and beb fw versions are the same + if (fwversion != feblfwversion || fwversion != febrfwversion) { + sprintf(initErrorMessage, + "Inconsistent firmware versions in feb and beb. [Beb: %lld, " + "Febl: %lld Febr: %lld]\n", + (long long int)fwversion, (long long int)feblfwversion, + (long long int)febrfwversion); + LOG(logERROR, (initErrorMessage)); + initError = FAIL; + return; + } + #endif // also reads config file and deactivates setupDetector(); diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/eigerDetectorServer/slsDetectorServer_defs.h index f37e98448..57c8d9a0c 100644 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorServer_defs.h @@ -5,6 +5,11 @@ #define LINKED_SERVER_NAME "eigerDetectorServer" +#define NUM_HARDWARE_VERSIONS (2) +#define HARDWARE_VERSION_NUMBERS {0x0, 0x1}; +#define HARDWARE_VERSION_NAMES \ + { "FX70T", "FX30T" } + #define REQUIRED_FIRMWARE_VERSION (31) // virtual ones renamed for consistency // real ones keep previous name for compatibility (already in production) diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h index 88eeaf95f..0570be4a5 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h @@ -82,8 +82,10 @@ u_int64_t getFirmwareVersion(); uint64_t getFrontEndFirmwareVersion(enum fpgaPosition fpgaPosition); #endif u_int64_t getFirmwareAPIVersion(); -#ifndef EIGERD void getHardwareVersion(char *version); +#ifdef EIGERD +int getHardwareVersionNumber(); +#else u_int16_t getHardwareVersionNumber(); #endif #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(CHIPTESTBOARDD) diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 86b311c02..229911c1f 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -732,8 +732,14 @@ int get_firmware_version(int file_des) { memset(mess, 0, sizeof(mess)); int64_t retval = -1; retval = getFirmwareVersion(); - LOG(logDEBUG1, - ("firmware version retval: 0x%llx\n", (long long int)retval)); + if (retval == 0) { + ret = FAIL; + strcpy(mess, "Could not get firmware version\n"); + LOG(logERROR, (mess)); + } else { + LOG(logDEBUG1, + ("firmware version retval: 0x%llx\n", (long long int)retval)); + } return Server_SendResult(file_des, INT64, &retval, sizeof(retval)); } @@ -10138,12 +10144,8 @@ int get_hardware_version(int file_des) { memset(mess, 0, sizeof(mess)); char retvals[MAX_STR_LENGTH]; memset(retvals, 0, MAX_STR_LENGTH); -#ifdef EIGERD - functionNotImplemented(); -#else getHardwareVersion(retvals); LOG(logDEBUG1, ("hardware version retval: %s\n", retvals)); -#endif return Server_SendResult(file_des, OTHER, retvals, sizeof(retvals)); } @@ -10171,9 +10173,15 @@ int get_frontend_firmware_version(int file_des) { } if (ret == OK) { retval = getFrontEndFirmwareVersion(arg); - LOG(logDEBUG1, - ("Front %s version retval: 0x%llx\n", - (arg == FRONT_LEFT ? "left" : "right"), (long long int)retval)); + if (retval == 0) { + ret = FAIL; + strcpy(mess, "Could not get febl/r firmware version\n"); + LOG(logERROR, (mess)); + } else { + LOG(logDEBUG1, ("Front %s version retval: 0x%llx\n", + (arg == FRONT_LEFT ? "left" : "right"), + (long long int)retval)); + } } #endif return Server_SendResult(file_des, INT64, &retval, sizeof(retval)); diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index 9d5c47061..790a951e1 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -85,7 +85,6 @@ class Detector { Result getDetectorServerVersion(Positions pos = {}) const; - /** [Jungfrau][Moench][Gotthard2][Myhten3][Gotthard][Ctb] */ Result getHardwareVersion(Positions pos = {}) const; Result getKernelVersion(Positions pos = {}) const; diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp index 04bc5b62c..bc812601d 100644 --- a/slsDetectorSoftware/src/CmdProxy.cpp +++ b/slsDetectorSoftware/src/CmdProxy.cpp @@ -279,11 +279,7 @@ std::string CmdProxy::Versions(int action) { auto t = det->getFirmwareVersion(std::vector{det_id}); os << "\nType : " << OutString(det->getDetectorType()) << "\nRelease : " << det->getPackageVersion() << std::hex - << "\nClient : " << det->getClientVersion() - << "\nServer : " - << OutString(det->getDetectorServerVersion(std::vector{det_id})) - << "\nKernel : " - << OutString(det->getKernelVersion({std::vector{det_id}})); + << "\nClient : " << det->getClientVersion(); if (eiger) { os << "\nFirmware (Beb) : " @@ -297,11 +293,16 @@ std::string CmdProxy::Versions(int action) { } else { os << "\nFirmware : " << OutStringHex( - det->getFirmwareVersion(std::vector{det_id})) - << "\nHardware : " - << OutString(det->getHardwareVersion(std::vector{det_id})); + det->getFirmwareVersion(std::vector{det_id})); } + os << "\nServer : " + << OutString(det->getDetectorServerVersion(std::vector{det_id})) + << "\nKernel : " + << OutString(det->getKernelVersion({std::vector{det_id}})) + << "\nHardware : " + << OutString(det->getHardwareVersion(std::vector{det_id})); + if (det->getUseReceiverFlag().squash(true)) { os << "\nReceiver : " << OutString(det->getReceiverVersion(std::vector{det_id})); diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index 2d2332e2b..2de6ab3db 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -1244,7 +1244,8 @@ class CmdProxy { GET_COMMAND(hardwareversion, getHardwareVersion, "\n\t[Jungfrau][Gotthard2][Myhten3][Gotthard][Ctb][Moench] " - "Hardware version of detector."); + "Hardware version of detector. \n\t[Eiger] Hardware version of " + "front FPGA on detector."); GET_COMMAND( kernelversion, getKernelVersion, diff --git a/slsDetectorSoftware/tests/test-CmdProxy.cpp b/slsDetectorSoftware/tests/test-CmdProxy.cpp index 52fb179f7..1f03f9e15 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy.cpp @@ -116,14 +116,8 @@ TEST_CASE("detectorserverversion", "[.cmd]") { TEST_CASE("hardwareversion", "[.cmd]") { Detector det; CmdProxy proxy(&det); - auto det_type = det.getDetectorType().squash(); - if (det_type != defs::EIGER) { - REQUIRE_NOTHROW(proxy.Call("hardwareversion", {}, -1, GET)); - REQUIRE_THROWS(proxy.Call("hardwareversion", {"0"}, -1, PUT)); - } else { - REQUIRE_THROWS(proxy.Call("hardwareversion", {"0"}, -1, PUT)); - REQUIRE_THROWS(proxy.Call("hardwareversion", {}, -1, GET)); - } + REQUIRE_NOTHROW(proxy.Call("hardwareversion", {}, -1, GET)); + REQUIRE_THROWS(proxy.Call("hardwareversion", {"0"}, -1, PUT)); } TEST_CASE("kernelversion", "[.cmd]") { @@ -519,7 +513,7 @@ TEST_CASE("gappixels", "[.cmd]") { // test eiger(quad or full module only) bool gapPixelTest = false; - if (det_type == defs:: || det_type == defs::MOENCH) + if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) gapPixelTest = true; else if (det_type == defs::EIGER) { bool quad = det.getQuad().squash(false); diff --git a/slsReceiverSoftware/src/ClientInterface.cpp b/slsReceiverSoftware/src/ClientInterface.cpp index 7dbea2135..1d0915ebc 100644 --- a/slsReceiverSoftware/src/ClientInterface.cpp +++ b/slsReceiverSoftware/src/ClientInterface.cpp @@ -402,7 +402,8 @@ int ClientInterface::setup_receiver(Interface &socket) { impl()->setDynamicRange(arg.dynamicRange); } impl()->setTimingMode(arg.timMode); - if (detType == EIGER || detType == CHIPTESTBOARD || detType == MYTHEN3) { + if (detType == EIGER || detType == CHIPTESTBOARD || + detType == MYTHEN3) { impl()->setTenGigaEnable(arg.tenGiga); } if (detType == CHIPTESTBOARD) { diff --git a/slsReceiverSoftware/src/Implementation.cpp b/slsReceiverSoftware/src/Implementation.cpp index abfc86a37..1e1337cd2 100644 --- a/slsReceiverSoftware/src/Implementation.cpp +++ b/slsReceiverSoftware/src/Implementation.cpp @@ -1132,7 +1132,7 @@ int Implementation::getUDPSocketBufferSize() const { void Implementation::setUDPSocketBufferSize(const int s) { size_t listSize = listener.size(); - if ((generalData->detType == JUNGFRAU || generalData->detType == MOENCH || + if ((generalData->detType == JUNGFRAU || generalData->detType == MOENCH || generalData->detType == GOTTHARD2) && (int)listSize != generalData->numUDPInterfaces) { throw RuntimeError("Number of Interfaces " + diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index c13e7cede..a079a110f 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -1,13 +1,13 @@ // SPDX-License-Identifier: LGPL-3.0-or-other // Copyright (C) 2021 Contributors to the SLS Detector Package /** API versions */ -#define RELEASE "developer" -#define APICTB "developer 0x230224" -#define APIGOTTHARD "developer 0x230224" +#define RELEASE "developer" +#define APICTB "developer 0x230224" +#define APIGOTTHARD "developer 0x230224" #define APIGOTTHARD2 "developer 0x230224" -#define APIJUNGFRAU "developer 0x230224" -#define APIMYTHEN3 "developer 0x230224" -#define APIMOENCH "developer 0x230224" +#define APIJUNGFRAU "developer 0x230224" +#define APIMYTHEN3 "developer 0x230224" +#define APIMOENCH "developer 0x230224" +#define APILIB "developer 0x230224" +#define APIRECEIVER "developer 0x230224" #define APIEIGER "developer 0x230224" -#define APILIB "developer 0x230224" -#define APIRECEIVER "developer 0x230224"