diff --git a/RELEASE.txt b/RELEASE.txt index bcf241653..f0ad19995 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -127,6 +127,7 @@ This document describes the differences between v7.0.0 and v6.x.x - gui nios temperature added - detector header change (bunchid, reserved, debug, roundRnumber) ->detSpec1 - 4 -ctb and moench (allowing all clkdivs (totaldiv was a float instead of int)) + - hardwareversion - jungfrau connected moduleid to detid_jungfrau.txt on board diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index b14f582c8..aeae768b4 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -229,6 +229,14 @@ class Detector(CppDetectorApi): """ return self.getDetectorServerVersion() + @property + @element + def hardwareversion(self): + """ + [Jungfrau][Gotthard2][Myhten3][Gotthard][Ctb][Moench] Hardware version of detector. + """ + return ut.lhex(self.getHardwareVersion()) + @property @element def kernelversion(self): @@ -1721,6 +1729,7 @@ class Detector(CppDetectorApi): 'client': self.clientversion, 'firmware': self.firmwareversion, 'detectorserver': self.detectorserverversion, + 'hardware':self.hardwareversion, 'kernel': self.kernelversion, 'receiver': self.rx_version} diff --git a/python/src/detector.cpp b/python/src/detector.cpp index 8b1e1e0b2..587565b99 100644 --- a/python/src/detector.cpp +++ b/python/src/detector.cpp @@ -66,6 +66,11 @@ void init_det(py::module &m) { (Result(Detector::*)(sls::Positions) const) & Detector::getDetectorServerVersion, py::arg() = Positions{}); + CppDetectorApi.def( + "getHardwareVersion", + (Result(Detector::*)(sls::Positions) const) & + Detector::getHardwareVersion, + py::arg() = Positions{}); CppDetectorApi.def( "getKernelVersion", (Result(Detector::*)(sls::Positions) const) & diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer index 94a4ca46d..a680b6fca 100755 Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c index 84d904f45..8c3fb618a 100644 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c @@ -116,7 +116,9 @@ void basictests() { return; } #endif - uint16_t hversion = getHardwareVersionNumber(); + char hversion[MAX_STR_LENGTH] = {0}; + memset(hversion, 0, MAX_STR_LENGTH); + getHardwareVersion(hversion); uint16_t hsnumber = getHardwareSerialNumber(); uint32_t ipadd = getDetectorIP(); uint64_t macadd = getDetectorMAC(); @@ -130,7 +132,7 @@ void basictests() { sw_fw_apiversion = getFirmwareAPIVersion(); LOG(logINFOBLUE, ("**************************************************\n" - "Hardware Version:\t\t 0x%x\n" + "Hardware Version:\t\t %s\n" "Hardware Serial Nr:\t\t 0x%x\n" "Detector IP Addr:\t\t 0x%x\n" @@ -341,9 +343,24 @@ uint64_t getFirmwareAPIVersion() { return ((bus_r(API_VERSION_REG) & API_VERSION_MSK) >> API_VERSION_OFST); } +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; + } + } +} + uint16_t getHardwareVersionNumber() { #ifdef VIRTUAL - return 0; + return 0x3f; #endif return ((bus_r(MOD_SERIAL_NUMBER_REG) & MOD_SERIAL_NUMBER_VRSN_MSK) >> MOD_SERIAL_NUMBER_VRSN_OFST); diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/ctbDetectorServer/slsDetectorServer_defs.h index c9317dccf..89bf864f6 100644 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorServer_defs.h @@ -7,10 +7,90 @@ #define MIN_REQRD_VRSN_T_RD_API 0x181130 #define REQRD_FRMWR_VRSN 0x220825 +#define NUM_HARDWARE_VERSIONS (1) +#define HARDWARE_VERSION_NUMBERS \ + { 0x3f } +#define HARDWARE_VERSION_NAMES \ + { "5.1" } + #define LINKED_SERVER_NAME "ctbDetectorServer" #define CTRL_SRVR_INIT_TIME_US (2 * 1000 * 1000) +/* Hardware Definitions */ +#define NCHAN (36) +#define NCHAN_ANALOG (32) +#define NCHAN_DIGITAL (64) +#define NCHIP (1) +#define NDAC (24) +#define NPWR (6) +#define NDAC_ONLY (NDAC - NPWR) +#define DYNAMIC_RANGE (16) +#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8) +#define CLK_FREQ (156.25) // MHz +#define I2C_POWER_VIO_DEVICE_ID (0x40) +#define I2C_POWER_VA_DEVICE_ID (0x41) +#define I2C_POWER_VB_DEVICE_ID (0x42) +#define I2C_POWER_VC_DEVICE_ID (0x43) +#define I2C_POWER_VD_DEVICE_ID (0x44) +#define I2C_SHUNT_RESISTER_OHMS (0.005) + +/** Default Parameters */ +#define DEFAULT_DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL) +#define DEFAULT_STARTING_FRAME_NUMBER (1) +#define DEFAULT_NUM_SAMPLES (1) +#define DEFAULT_NUM_FRAMES (1) +#define DEFAULT_EXPTIME (0) +#define DEFAULT_NUM_CYCLES (1) +#define DEFAULT_PERIOD (1 * 1000 * 1000) // ns +#define DEFAULT_DELAY (0) +#define DEFAULT_HIGH_VOLTAGE (0) +#define DEFAULT_VLIMIT (-100) +#define DEFAULT_TIMING_MODE (AUTO_TIMING) +#define DEFAULT_TX_UDP_PORT (0x7e9a) +#define DEFAULT_RUN_CLK (200) // 40 +#define DEFAULT_ADC_CLK (40) // 20 +#define DEFAULT_SYNC_CLK (40) // 20 +#define DEFAULT_DBIT_CLK (200) + +#define UDP_HEADER_MAX_FRAME_VALUE (0xFFFFFFFFFFFF) + +#define HIGHVOLTAGE_MIN (60) +#define HIGHVOLTAGE_MAX (200) // min dac val +#define DAC_MIN_MV (0) +#define DAC_MAX_MV (2500) +#define VCHIP_MIN_MV (1673) +#define VCHIP_MAX_MV (2668) // min dac val +#define POWER_RGLTR_MIN (636) +#define POWER_RGLTR_MAX \ + (2638) // min dac val (not vchip-max) because of dac conversions +#define VCHIP_POWER_INCRMNT (200) +#define VIO_MIN_MV (1200) // for fpga to function + +/* Defines in the Firmware */ +#define DIGITAL_IO_DELAY_MAXIMUM_PS \ + ((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * \ + OUTPUT_DELAY_0_OTPT_STTNG_STEPS) +#define MAX_PHASE_SHIFTS_STEPS (8) + +#define WAIT_TME_US_FR_ACQDONE_REG \ + (100) // wait time in us after acquisition done to ensure there is no data + // in fifo +#define WAIT_TIME_US_PLL (10 * 1000) +#define WAIT_TIME_US_STP_ACQ (100) +#define WAIT_TIME_CONFIGURE_MAC (2 * 1000 * 1000) +#define WAIT_TIME_PATTERN_READ (10) +#define WAIT_TIME_1US_FOR_LOOP_CNT (50) // around 30 is 1 us in blackfin + +/* MSB & LSB DEFINES */ +#define MSB_OF_64_BIT_REG_OFST (32) +#define LSB_OF_64_BIT_REG_OFST (0) +#define BIT32_MSK (0xFFFFFFFF) +#define BIT16_MASK (0xFFFF) + +#define MAXIMUM_ADC_CLK (65) +#define PLL_VCO_FREQ_MHZ (800) + /* Struct Definitions */ typedef struct udp_header_struct { uint32_t udp_destmac_msb; @@ -88,77 +168,3 @@ enum DACINDEX { }; enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS }; #define CLK_NAMES "run", "adc", "sync", "dbit" - -/* Hardware Definitions */ -#define NCHAN (36) -#define NCHAN_ANALOG (32) -#define NCHAN_DIGITAL (64) -#define NCHIP (1) -#define NDAC (24) -#define NPWR (6) -#define NDAC_ONLY (NDAC - NPWR) -#define DYNAMIC_RANGE (16) -#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8) -#define CLK_FREQ (156.25) // MHz -#define I2C_POWER_VIO_DEVICE_ID (0x40) -#define I2C_POWER_VA_DEVICE_ID (0x41) -#define I2C_POWER_VB_DEVICE_ID (0x42) -#define I2C_POWER_VC_DEVICE_ID (0x43) -#define I2C_POWER_VD_DEVICE_ID (0x44) -#define I2C_SHUNT_RESISTER_OHMS (0.005) - -/** Default Parameters */ -#define DEFAULT_DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL) -#define DEFAULT_STARTING_FRAME_NUMBER (1) -#define DEFAULT_NUM_SAMPLES (1) -#define DEFAULT_NUM_FRAMES (1) -#define DEFAULT_EXPTIME (0) -#define DEFAULT_NUM_CYCLES (1) -#define DEFAULT_PERIOD (1 * 1000 * 1000) // ns -#define DEFAULT_DELAY (0) -#define DEFAULT_HIGH_VOLTAGE (0) -#define DEFAULT_VLIMIT (-100) -#define DEFAULT_TIMING_MODE (AUTO_TIMING) -#define DEFAULT_TX_UDP_PORT (0x7e9a) -#define DEFAULT_RUN_CLK (200) // 40 -#define DEFAULT_ADC_CLK (40) // 20 -#define DEFAULT_SYNC_CLK (40) // 20 -#define DEFAULT_DBIT_CLK (200) - -#define UDP_HEADER_MAX_FRAME_VALUE (0xFFFFFFFFFFFF) - -#define HIGHVOLTAGE_MIN (60) -#define HIGHVOLTAGE_MAX (200) // min dac val -#define DAC_MIN_MV (0) -#define DAC_MAX_MV (2500) -#define VCHIP_MIN_MV (1673) -#define VCHIP_MAX_MV (2668) // min dac val -#define POWER_RGLTR_MIN (636) -#define POWER_RGLTR_MAX \ - (2638) // min dac val (not vchip-max) because of dac conversions -#define VCHIP_POWER_INCRMNT (200) -#define VIO_MIN_MV (1200) // for fpga to function - -/* Defines in the Firmware */ -#define DIGITAL_IO_DELAY_MAXIMUM_PS \ - ((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * \ - OUTPUT_DELAY_0_OTPT_STTNG_STEPS) -#define MAX_PHASE_SHIFTS_STEPS (8) - -#define WAIT_TME_US_FR_ACQDONE_REG \ - (100) // wait time in us after acquisition done to ensure there is no data - // in fifo -#define WAIT_TIME_US_PLL (10 * 1000) -#define WAIT_TIME_US_STP_ACQ (100) -#define WAIT_TIME_CONFIGURE_MAC (2 * 1000 * 1000) -#define WAIT_TIME_PATTERN_READ (10) -#define WAIT_TIME_1US_FOR_LOOP_CNT (50) // around 30 is 1 us in blackfin - -/* MSB & LSB DEFINES */ -#define MSB_OF_64_BIT_REG_OFST (32) -#define LSB_OF_64_BIT_REG_OFST (0) -#define BIT32_MSK (0xFFFFFFFF) -#define BIT16_MASK (0xFFFF) - -#define MAXIMUM_ADC_CLK (65) -#define PLL_VCO_FREQ_MHZ (800) diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer index 375cb1ae5..22bc1f759 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 b6a9d3dd7..5366e446e 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -113,7 +113,9 @@ void basictests() { return; } #endif - uint16_t hversion = getHardwareVersionNumber(); + char hversion[MAX_STR_LENGTH] = {0}; + memset(hversion, 0, MAX_STR_LENGTH); + getHardwareVersion(hversion); uint32_t ipadd = getDetectorIP(); uint64_t macadd = getDetectorMAC(); int64_t fwversion = getFirmwareVersion(); @@ -125,7 +127,7 @@ void basictests() { LOG(logINFOBLUE, ("**************************************************\n" - "Hardware Version:\t\t 0x%x\n" + "Hardware Version:\t\t %s\n" "Detector IP Addr:\t\t 0x%x\n" "Detector MAC Addr:\t\t 0x%llx\n\n" @@ -267,14 +269,34 @@ u_int64_t getFirmwareAPIVersion() { return ((bus_r(API_VERSION_REG) & API_VERSION_MSK) >> API_VERSION_OFST); } +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; + } + } +} + u_int16_t getHardwareVersionNumber() { #ifdef VIRTUAL - return 0; + return 0x2; #endif return ((bus_r(MCB_SERIAL_NO_REG) & MCB_SERIAL_NO_VRSN_MSK) >> MCB_SERIAL_NO_VRSN_OFST); } +int isHardwareVersion_1_0() { + const int hwNumberList[] = HARDWARE_VERSION_NUMBERS; + return ((getHardwareVersionNumber() == hwNumberList[0]) ? 1 : 0); +} + u_int32_t getDetectorNumber() { #ifdef VIRTUAL return 0; diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h index e6839723e..d54c39643 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h @@ -7,6 +7,11 @@ #define KERNEL_DATE_VRSN "Mon May 10 18:00:21 CEST 2021" #define ID_FILE "detid_gotthard2.txt" +#define NUM_HARDWARE_VERSIONS (2) +#define HARDWARE_VERSION_NUMBERS {0x0, 0x2}; +#define HARDWARE_VERSION_NAMES \ + { "1.0", "1.2" } + #define LINKED_SERVER_NAME "gotthard2DetectorServer" #define CTRL_SRVR_INIT_TIME_US (300 * 1000) diff --git a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer index 6d9bd6cc4..745c14b42 100755 Binary files a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer and b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer differ diff --git a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c index 20641ed84..ae6308439 100644 --- a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c @@ -103,7 +103,9 @@ void basictests() { return; } #endif - uint32_t boardrev = getBoardRevision(); + char hversion[MAX_STR_LENGTH] = {0}; + memset(hversion, 0, MAX_STR_LENGTH); + getHardwareVersion(hversion); uint32_t ipadd = getDetectorIP(); uint64_t macadd = getDetectorMAC(); int64_t fwversion = getFirmwareVersion(); @@ -113,7 +115,7 @@ void basictests() { LOG(logINFOBLUE, ("**************************************************\n" - "Board Revision : 0x%x\n" + "Hardware Revision : %s\n" "Detector IP Addr : 0x%x\n" "Detector MAC Addr : 0x%llx\n\n" @@ -121,7 +123,7 @@ void basictests() { "Firmware Version : 0x%llx\n" "Software Version : %s\n" "********************************************************\n", - boardrev, + hversion, ipadd, (long long unsigned int)macadd, @@ -335,14 +337,34 @@ u_int32_t getDetectorIP() { return res; } -u_int32_t getBoardRevision() { +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; + } + } +} + +u_int16_t getHardwareVersionNumber() { #ifdef VIRTUAL - return 0; + return 0x2; #endif return ((bus_r(BOARD_REVISION_REG) & BOARD_REVISION_MSK) >> BOARD_REVISION_OFST); } +int isHardwareVersion_1_0() { + const int hwNumberList[] = HARDWARE_VERSION_NUMBERS; + return ((getHardwareVersionNumber() == hwNumberList[0]) ? 1 : 0); +} + /* initialization */ void initControlServer() { @@ -394,7 +416,7 @@ void setupDetector() { setHighVoltage(DEFAULT_HIGH_VOLTAGE); // adc - if (getBoardRevision() == 1) { + if (isHardwareVersion_1_0()) { AD9252_SetDefines(ADC_SPI_REG, ADC_SPI_SRL_CS_OTPT_MSK, ADC_SPI_SRL_CLK_OTPT_MSK, ADC_SPI_SRL_DT_OTPT_MSK, ADC_SPI_SRL_DT_OTPT_OFST); @@ -579,7 +601,7 @@ void setDAQRegister() { // 0x1f16(board rev 1) 0x1f0f(board rev 2) u_int32_t tokenTiming = - ((getBoardRevision() == 1) ? DAQ_TKN_TMNG_BRD_RVSN_1_VAL + ((isHardwareVersion_1_0()) ? DAQ_TKN_TMNG_BRD_RVSN_1_VAL : DAQ_TKN_TMNG_BRD_RVSN_2_VAL); // 0x13f(no roi), 0x7f(roi) diff --git a/slsDetectorServers/gotthardDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/gotthardDetectorServer/slsDetectorServer_defs.h index 89d38eefc..c81c2325c 100644 --- a/slsDetectorServers/gotthardDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/gotthardDetectorServer/slsDetectorServer_defs.h @@ -4,6 +4,12 @@ #include "sls/sls_detector_defs.h" #include +#define NUM_HARDWARE_VERSIONS (2) +#define HARDWARE_VERSION_NUMBERS \ + { 0x1, 0x2 } +#define HARDWARE_VERSION_NAMES \ + { "1.0", "2.0" } + #define LINKED_SERVER_NAME "gotthardDetectorServer" #define CTRL_SRVR_INIT_TIME_US (300 * 1000) diff --git a/slsDetectorServers/jungfrauDetectorServer/RegisterDefs.h b/slsDetectorServers/jungfrauDetectorServer/RegisterDefs.h index cfd3c0d80..488fbdc09 100644 --- a/slsDetectorServers/jungfrauDetectorServer/RegisterDefs.h +++ b/slsDetectorServers/jungfrauDetectorServer/RegisterDefs.h @@ -61,7 +61,6 @@ #define HARDWARE_SERIAL_NUM_MSK (0x000000FF << HARDWARE_SERIAL_NUM_OFST) #define HARDWARE_VERSION_NUM_OFST (16) #define HARDWARE_VERSION_NUM_MSK (0x0000003F << HARDWARE_VERSION_NUM_OFST) -#define HARDWARE_VERSION_2_VAL ((0x2 << HARDWARE_VERSION_NUM_OFST) & HARDWARE_VERSION_NUM_MSK) /* API Version Register */ #define API_VERSION_REG (0x0F << MEM_MAP_SHIFT) diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer index 606c0b0b9..1a85d4cc9 100755 Binary files a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer differ diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index bb68c19cd..08532457b 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -98,7 +98,9 @@ void basictests() { return; } #endif - uint16_t hversion = getHardwareVersionNumber(); + char hversion[MAX_STR_LENGTH] = {0}; + memset(hversion, 0, MAX_STR_LENGTH); + getHardwareVersion(hversion); uint16_t hsnumber = getHardwareSerialNumber(); uint32_t ipadd = getDetectorIP(); uint64_t macadd = getDetectorMAC(); @@ -108,14 +110,15 @@ void basictests() { getServerVersion(swversion); int64_t sw_fw_apiversion = 0; uint32_t requiredFirmwareVersion = - (isHardwareVersion2() ? REQRD_FRMWRE_VRSN_BOARD2 : REQRD_FRMWRE_VRSN); + (isHardwareVersion_1_0() ? REQRD_FRMWRE_VRSN_BOARD2 + : REQRD_FRMWRE_VRSN); if (fwversion >= MIN_REQRD_VRSN_T_RD_API) sw_fw_apiversion = getFirmwareAPIVersion(); LOG(logINFOBLUE, ("************ Jungfrau Server *********************\n" - "Hardware Version:\t\t 0x%x\n" + "Hardware Version:\t\t %s\n" "Hardware Serial Nr:\t\t 0x%x\n" "Detector IP Addr:\t\t 0x%x\n" @@ -274,9 +277,24 @@ u_int64_t getFirmwareAPIVersion() { return ((bus_r(API_VERSION_REG) & API_VERSION_MSK) >> API_VERSION_OFST); } +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; + } + } +} + u_int16_t getHardwareVersionNumber() { #ifdef VIRTUAL - return 0; + return 0x3; #endif return ((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_VERSION_NUM_MSK) >> HARDWARE_VERSION_NUM_OFST); @@ -290,15 +308,9 @@ u_int16_t getHardwareSerialNumber() { HARDWARE_SERIAL_NUM_OFST); } -// is board 1.0?, with value 2 (resistor network) -int isHardwareVersion2() { -#ifdef VIRTUAL - return 0; -#endif - return (((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_VERSION_NUM_MSK) == - HARDWARE_VERSION_2_VAL) - ? 1 - : 0); +int isHardwareVersion_1_0() { + const int hwNumberList[] = HARDWARE_VERSION_NUMBERS; + return ((getHardwareVersionNumber() == hwNumberList[0]) ? 1 : 0); } int getChipVersion() { @@ -504,8 +516,8 @@ void setupDetector() { alignDeserializer(); configureASICTimer(); bus_w(ADC_PORT_INVERT_REG, - (isHardwareVersion2() ? ADC_PORT_INVERT_BOARD2_VAL - : ADC_PORT_INVERT_VAL)); + (isHardwareVersion_1_0() ? ADC_PORT_INVERT_BOARD2_VAL + : ADC_PORT_INVERT_VAL)); initReadoutConfiguration(); @@ -537,7 +549,7 @@ void setupDetector() { setFilterResistor(DEFAULT_FILTER_RESISTOR); setNumberOfFilterCells(DEFAULT_FILTER_CELL); } - if (!isHardwareVersion2()) { + if (!isHardwareVersion_1_0()) { setFlipRows(DEFAULT_FLIP_ROWS); setReadNRows(MAX_ROWS_PER_READOUT); } @@ -776,11 +788,11 @@ int readConfigFile() { version, line); break; } - // version 1.1 and HW 1.0 (version reg value = 2) is incompatible - if (version == 11 && isHardwareVersion2()) { + // chipversion 1.1 and HW 1.0 is incompatible + if (version == 11 && isHardwareVersion_1_0()) { strcpy(initErrorMessage, "Chip version 1.1 (from on-board config file) is " - "incompatible with old board (v1.0). Please update " + "incompatible with hardware version v1.0. Please update " "board or correct on-board config file.\n"); break; } @@ -855,8 +867,9 @@ int getDynamicRange(int *retval) { void setADCInvertRegister(uint32_t val) { LOG(logINFO, ("Setting ADC Port Invert Reg to 0x%x\n", val)); - uint32_t defaultValue = (isHardwareVersion2() ? ADC_PORT_INVERT_BOARD2_VAL - : ADC_PORT_INVERT_VAL); + uint32_t defaultValue = + (isHardwareVersion_1_0() ? ADC_PORT_INVERT_BOARD2_VAL + : ADC_PORT_INVERT_VAL); uint32_t changeValue = defaultValue ^ val; LOG(logINFO, ("\t default: 0x%x, final:0x%x\n", defaultValue, changeValue)); bus_w(ADC_PORT_INVERT_REG, changeValue); @@ -864,8 +877,8 @@ void setADCInvertRegister(uint32_t val) { uint32_t getADCInvertRegister() { uint32_t readValue = bus_r(ADC_PORT_INVERT_REG); - int32_t defaultValue = (isHardwareVersion2() ? ADC_PORT_INVERT_BOARD2_VAL - : ADC_PORT_INVERT_VAL); + int32_t defaultValue = (isHardwareVersion_1_0() ? ADC_PORT_INVERT_BOARD2_VAL + : ADC_PORT_INVERT_VAL); uint32_t val = defaultValue ^ readValue; LOG(logDEBUG1, ("\tread:0x%x, default:0x%x returned:0x%x\n", readValue, defaultValue, val)); @@ -1779,9 +1792,9 @@ int setReadNRows(int value) { LOG(logERROR, ("Invalid number of rows %d\n", value)); return FAIL; } - if (isHardwareVersion2()) { + if (isHardwareVersion_1_0()) { LOG(logERROR, ("Could not set number of rows. Only available for " - "Hardware Board version 2.0.\n")); + "Hardware Board version v2.0.\n")); return FAIL; } @@ -1804,7 +1817,7 @@ int setReadNRows(int value) { int getReadNRows() { // cannot set it in old board - if (isHardwareVersion2()) { + if (isHardwareVersion_1_0()) { return MAX_ROWS_PER_READOUT; } int enable = (bus_r(READ_N_ROWS_REG) & READ_N_ROWS_ENBL_MSK); @@ -1977,7 +1990,7 @@ int setReadoutSpeed(int val) { switch (val) { case FULL_SPEED: - if (isHardwareVersion2()) { + if (isHardwareVersion_1_0()) { LOG(logERROR, ("Cannot set full speed. Should not be here\n")); return FAIL; } @@ -1998,7 +2011,7 @@ int setReadoutSpeed(int val) { case HALF_SPEED: LOG(logINFO, ("Setting Half Speed (20 MHz):\n")); - if (isHardwareVersion2()) { + if (isHardwareVersion_1_0()) { adcOfst = ADC_OFST_HALF_SPEED_BOARD2_VAL; sampleAdcSpeed = SAMPLE_ADC_HALF_SPEED_BOARD2; adcPhase = ADC_PHASE_HALF_SPEED_BOARD2; @@ -2019,7 +2032,7 @@ int setReadoutSpeed(int val) { case QUARTER_SPEED: LOG(logINFO, ("Setting Half Speed (10 MHz):\n")); - if (isHardwareVersion2()) { + if (isHardwareVersion_1_0()) { adcOfst = ADC_OFST_QUARTER_SPEED_BOARD2_VAL; sampleAdcSpeed = SAMPLE_ADC_QUARTER_SPEED_BOARD2; adcPhase = ADC_PHASE_QUARTER_SPEED_BOARD2; @@ -2279,7 +2292,7 @@ int getFlipRows() { } void setFlipRows(int arg) { - if (isHardwareVersion2()) { + if (isHardwareVersion_1_0()) { LOG(logERROR, ("Could not set flip rows. Only available for " "Hardware Board version 2.0.\n")); return; diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h index 80bc8f7f9..2f738405b 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h @@ -8,8 +8,13 @@ #define REQRD_FRMWRE_VRSN_BOARD2 0x220421 // 1.0 pcb (version = 010) #define REQRD_FRMWRE_VRSN 0x220422 // 2.0 pcb (version = 011) -#define ID_FILE "detid_jungfrau.txt" +#define NUM_HARDWARE_VERSIONS (2) +#define HARDWARE_VERSION_NUMBERS \ + { 0x2, 0x3 } +#define HARDWARE_VERSION_NAMES \ + { "1.0", "2.0" } +#define ID_FILE "detid_jungfrau.txt" #define LINKED_SERVER_NAME "jungfrauDetectorServer" #define CTRL_SRVR_INIT_TIME_US (300 * 1000) diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer index 08f813da6..c7c21c2cb 100755 Binary files a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer differ diff --git a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c index 570032810..27c1bdbb1 100644 --- a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c @@ -120,7 +120,9 @@ void basictests() { return; } #endif - uint16_t hversion = getHardwareVersionNumber(); + char hversion[MAX_STR_LENGTH] = {0}; + memset(hversion, 0, MAX_STR_LENGTH); + getHardwareVersion(hversion); uint16_t hsnumber = getHardwareSerialNumber(); uint32_t ipadd = getDetectorIP(); uint64_t macadd = getDetectorMAC(); @@ -134,7 +136,7 @@ void basictests() { sw_fw_apiversion = getFirmwareAPIVersion(); LOG(logINFOBLUE, ("**************************************************\n" - "Hardware Version:\t\t 0x%x\n" + "Hardware Version:\t\t %s\n" "Hardware Serial Nr:\t\t 0x%x\n" "Detector IP Addr:\t\t 0x%x\n" @@ -345,9 +347,24 @@ uint64_t getFirmwareAPIVersion() { return ((bus_r(API_VERSION_REG) & API_VERSION_MSK) >> API_VERSION_OFST); } +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; + } + } +} + uint16_t getHardwareVersionNumber() { #ifdef VIRTUAL - return 0; + return 0x1; #endif return ((bus_r(MOD_SERIAL_NUMBER_REG) & MOD_SERIAL_NUMBER_VRSN_MSK) >> MOD_SERIAL_NUMBER_VRSN_OFST); diff --git a/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h index e3c6e0ed6..3db8a8011 100644 --- a/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h @@ -7,6 +7,12 @@ #define MIN_REQRD_VRSN_T_RD_API 0x180314 #define REQRD_FRMWR_VRSN 0x220825 +#define NUM_HARDWARE_VERSIONS (1) +#define HARDWARE_VERSION_NUMBERS \ + { 0x1 } +#define HARDWARE_VERSION_NAMES \ + { "1.0" } + #define LINKED_SERVER_NAME "moenchDetectorServer" #define CTRL_SRVR_INIT_TIME_US (2 * 1000 * 1000) diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer index 8205a9fb3..04d42976d 100755 Binary files a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer differ diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index 0d5b98fdd..2b5c98403 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -106,7 +106,9 @@ void basictests() { return; } #endif - uint16_t hversion = getHardwareVersionNumber(); + char hversion[MAX_STR_LENGTH] = {0}; + memset(hversion, 0, MAX_STR_LENGTH); + getHardwareVersion(hversion); uint32_t ipadd = getDetectorIP(); uint64_t macadd = getDetectorMAC(); int64_t fwversion = getFirmwareVersion(); @@ -118,7 +120,7 @@ void basictests() { LOG(logINFOBLUE, ("**************************************************\n" - "Hardware Version:\t\t 0x%x\n" + "Hardware Version:\t\t %s\n" "Detector IP Addr:\t\t 0x%x\n" "Detector MAC Addr:\t\t 0x%llx\n\n" @@ -259,14 +261,34 @@ u_int64_t getFirmwareAPIVersion() { return ((bus_r(API_VERSION_REG) & API_VERSION_MSK) >> API_VERSION_OFST); } +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; + } + } +} + u_int16_t getHardwareVersionNumber() { #ifdef VIRTUAL - return 0; + return 0x2; #endif return ((bus_r(MCB_SERIAL_NO_REG) & MCB_SERIAL_NO_VRSN_MSK) >> MCB_SERIAL_NO_VRSN_OFST); } +int isHardwareVersion_1_0() { + const int hwNumberList[] = HARDWARE_VERSION_NUMBERS; + return ((getHardwareVersionNumber() == hwNumberList[0]) ? 1 : 0); +} + u_int32_t getDetectorNumber() { #ifdef VIRTUAL return 0; diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h index 218d060d6..f908a9494 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h @@ -7,6 +7,11 @@ #define KERNEL_DATE_VRSN "Mon May 10 18:00:21 CEST 2021" #define ID_FILE "detid_mythen3.txt" +#define NUM_HARDWARE_VERSIONS (2) +#define HARDWARE_VERSION_NUMBERS {0x0, 0x2}; +#define HARDWARE_VERSION_NAMES \ + { "1.0", "1.2" } + #define LINKED_SERVER_NAME "mythen3DetectorServer" #define CTRL_SRVR_INIT_TIME_US (300 * 1000) diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h index 5f48ab167..71eaedf05 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h @@ -78,15 +78,18 @@ int getTestImageMode(); void getServerVersion(char *version); u_int64_t getFirmwareVersion(); u_int64_t getFirmwareAPIVersion(); -#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || \ - defined(MYTHEN3D) || defined(GOTTHARD2D) +#ifndef EIGERD +void getHardwareVersion(char *version); u_int16_t getHardwareVersionNumber(); #endif #if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) u_int16_t getHardwareSerialNumber(); #endif +#if defined(JUNGFRAUD) || defined(GOTTHARD2D) || defined(MYTHEN3D) || \ + defined(GOTTHARDD) +int isHardwareVersion_1_0(); +#endif #ifdef JUNGFRAUD -int isHardwareVersion2(); int getChipVersion(); void setChipVersion(int version); #endif @@ -105,9 +108,6 @@ void setModuleId(int modid); u_int64_t getDetectorMAC(); u_int32_t getDetectorIP(); -#ifdef GOTTHARDD -u_int32_t getBoardRevision(); -#endif // initialization void initControlServer(); diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h index 7164ad869..65ea37fbd 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h @@ -305,3 +305,4 @@ int set_digital_pulsing(int); int get_module(int); int get_synchronization(int); int set_synchronization(int); +int get_hardware_version(int); diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 805bebe03..6419060a0 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -469,6 +469,7 @@ void function_table() { flist[F_GET_MODULE] = &get_module; flist[F_GET_SYNCHRONIZATION] = &get_synchronization; flist[F_SET_SYNCHRONIZATION] = &set_synchronization; + flist[F_GET_HARDWARE_VERSION] = &get_hardware_version; // check if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) { @@ -3449,7 +3450,7 @@ int write_adc_register(int file_des) { #if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) AD9257_Set(addr, val); #elif GOTTHARDD - if (getBoardRevision() == 1) { + if (isHardwareVersion_1_0()) { AD9252_Set(addr, val); } else { AD9257_Set(addr, val); @@ -4217,7 +4218,7 @@ int reboot_controller(int file_des) { #elif VIRTUAL ret = GOODBYE; #elif defined(MYTHEN3D) || defined(GOTTHARD2D) - if (getHardwareVersionNumber() == 0) { + if (isHardwareVersion_1_0()) { ret = FAIL; strcpy(mess, "Old board version, reboot by yourself please!\n"); LOG(logINFORED, (mess)); @@ -4702,9 +4703,7 @@ int set_read_n_rows(int file_des) { "of %d\n", arg, READ_N_ROWS_MULTIPLE); LOG(logERROR, (mess)); - } - // only for HW 2.0 (version = 3) - else if (isHardwareVersion2()) { + } else if (isHardwareVersion_1_0()) { ret = FAIL; strcpy(mess, "Could not set number of rows. Only available for " "Hardware Board version 2.0.\n"); @@ -8801,8 +8800,7 @@ int get_flip_rows(int file_des) { functionNotImplemented(); #else // get only - // only for HW 2.0 (version = 3) - if (isHardwareVersion2()) { + if (isHardwareVersion_1_0()) { ret = FAIL; strcpy(mess, "Could not get flip rows. Only available for " "Hardware Board version 2.0.\n"); @@ -8835,9 +8833,7 @@ int set_flip_rows(int file_des) { sprintf(mess, "Could not set flip rows. Invalid argument %d.\n", arg); LOG(logERROR, (mess)); - } - // only for HW 2.0 (version = 3) - else if (isHardwareVersion2()) { + } else if (isHardwareVersion_1_0()) { ret = FAIL; strcpy(mess, "Could not set flip rows. Only available for " "Hardware Board version 2.0.\n"); @@ -9355,7 +9351,7 @@ int set_readout_speed(int file_des) { // only set if (Server_VerifyLock() == OK) { #ifdef JUNGFRAUD - if (arg == (int)FULL_SPEED && isHardwareVersion2()) { + if (arg == (int)FULL_SPEED && isHardwareVersion_1_0()) { ret = FAIL; strcpy( mess, @@ -10172,3 +10168,17 @@ int set_synchronization(int file_des) { #endif return Server_SendResult(file_des, INT32, NULL, 0); } + +int get_hardware_version(int file_des) { + ret = OK; + 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)); +} diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index 212ada191..4aba29d96 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -80,6 +80,9 @@ class Detector { Result getDetectorServerVersion(Positions pos = {}) const; + /** [Jungfrau][Gotthard2][Myhten3][Gotthard][Ctb][Moench] */ + Result getHardwareVersion(Positions pos = {}) const; + Result getKernelVersion(Positions pos = {}) const; /* [Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench] */ diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp index d138096f7..355e673e0 100644 --- a/slsDetectorSoftware/src/CmdProxy.cpp +++ b/slsDetectorSoftware/src/CmdProxy.cpp @@ -275,21 +275,24 @@ std::string CmdProxy::Versions(int action) { WrongNumberOfParameters(0); } auto t = det->getFirmwareVersion(std::vector{det_id}); - os << "\nDetector Type: " << OutString(det->getDetectorType()) - << "\nPackage Version: " << det->getPackageVersion() << std::hex - << "\nClient Version: " << det->getClientVersion(); + os << "\nType : " << OutString(det->getDetectorType()) + << "\nRelease : " << det->getPackageVersion() << std::hex + << "\nClient : " << det->getClientVersion(); + os << "\nFirmware : "; if (det->getDetectorType().squash() == defs::EIGER) { - os << "\nFirmware Version: " << OutString(t); + os << OutString(t); } else { - os << "\nFirmware Version: " << OutStringHex(t); + os << OutStringHex(t); } - os << "\nDetector Server Version: " + os << "\nServer : " << OutString( det->getDetectorServerVersion(std::vector{det_id})); - os << "\nDetector Kernel Version: " + os << "\nHardware : " + << OutString(det->getHardwareVersion(std::vector{det_id})); + os << "\nKernel : " << OutString(det->getKernelVersion({std::vector{det_id}})); if (det->getUseReceiverFlag().squash(true)) { - os << "\nReceiver Version: " + os << "\nReceiver : " << OutString(det->getReceiverVersion(std::vector{det_id})); } os << std::dec << '\n'; diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index dba07caa6..0d8529148 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -767,6 +767,7 @@ class CmdProxy { {"packageversion", &CmdProxy::PackageVersion}, {"clientversion", &CmdProxy::ClientVersion}, {"firmwareversion", &CmdProxy::FirmwareVersion}, + {"hardwareversion", &CmdProxy::hardwareversion}, {"detectorserverversion", &CmdProxy::detectorserverversion}, {"kernelversion", &CmdProxy::kernelversion}, {"rx_version", &CmdProxy::rx_version}, @@ -1235,6 +1236,10 @@ class CmdProxy { GET_COMMAND(detectorserverversion, getDetectorServerVersion, "\n\tOn-board detector server software version"); + GET_COMMAND(hardwareversion, getHardwareVersion, + "\n\tJungfrau][Gotthard2][Myhten3][Gotthard][Ctb][Moench] " + "Hardware version of detector."); + GET_COMMAND( kernelversion, getKernelVersion, "\n\tGet kernel version on the detector including time and date."); diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 78c954a1c..a12489d11 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -128,6 +128,10 @@ Result Detector::getDetectorServerVersion(Positions pos) const { return pimpl->Parallel(&Module::getDetectorServerVersion, pos); } +Result Detector::getHardwareVersion(Positions pos) const { + return pimpl->Parallel(&Module::getHardwareVersion, pos); +} + Result Detector::getKernelVersion(Positions pos) const { return pimpl->Parallel(&Module::getKernelVersion, pos); } @@ -2300,6 +2304,7 @@ void Detector::setAdditionalJsonParameter(const std::string &key, void Detector::programFPGA(const std::string &fname, const bool forceDeleteNormalFile, Positions pos) { LOG(logINFO) << "Updating Firmware..."; + LOG(logINFO) << "Hardware Version: " << getHardwareVersion(); std::vector buffer = pimpl->readProgrammingFile(fname); pimpl->Parallel(&Module::programFPGA, pos, buffer, forceDeleteNormalFile); rebootController(pos); diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index b35bb2b16..5772e2672 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -109,6 +109,12 @@ std::string Module::getDetectorServerVersion() const { return v.concise(); } +std::string Module::getHardwareVersion() const { + char retval[MAX_STR_LENGTH]{}; + sendToDetector(F_GET_HARDWARE_VERSION, nullptr, retval); + return retval; +} + std::string Module::getKernelVersion() const { char retval[MAX_STR_LENGTH]{}; sendToDetector(F_GET_KERNEL_VERSION, nullptr, retval); diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index 9f031b85d..58c6de954 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -93,6 +93,7 @@ class Module : public virtual slsDetectorDefs { std::string getControlServerLongVersion() const; std::string getStopServerLongVersion() const; std::string getDetectorServerVersion() const; + std::string getHardwareVersion() const; std::string getKernelVersion() const; int64_t getSerialNumber() const; int getModuleId() const; diff --git a/slsDetectorSoftware/tests/test-CmdProxy.cpp b/slsDetectorSoftware/tests/test-CmdProxy.cpp index c370d9733..91b043d56 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy.cpp @@ -114,6 +114,13 @@ TEST_CASE("detectorserverversion", "[.cmd]") { REQUIRE_THROWS(proxy.Call("detectorserverversion", {"0"}, -1, PUT)); } +TEST_CASE("hardwareversion", "[.cmd]") { + Detector det; + CmdProxy proxy(&det); + REQUIRE_NOTHROW(proxy.Call("hardwareversion", {}, -1, GET)); + REQUIRE_THROWS(proxy.Call("hardwareversion", {"0"}, -1, PUT)); +} + TEST_CASE("kernelversion", "[.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 9afcd56ba..da102064d 100755 --- a/slsSupportLib/include/sls/sls_detector_funcs.h +++ b/slsSupportLib/include/sls/sls_detector_funcs.h @@ -273,6 +273,7 @@ enum detFuncs { F_GET_MODULE, F_GET_SYNCHRONIZATION, F_SET_SYNCHRONIZATION, + F_GET_HARDWARE_VERSION, NUM_DET_FUNCTIONS, RECEIVER_ENUM_START = 512, /**< detector function should not exceed this @@ -651,6 +652,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) { case F_GET_MODULE: return "F_GET_MODULE"; case F_GET_SYNCHRONIZATION: return "F_GET_SYNCHRONIZATION"; case F_SET_SYNCHRONIZATION: return "F_SET_SYNCHRONIZATION"; + case F_GET_HARDWARE_VERSION: return "F_GET_HARDWARE_VERSION"; case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS"; case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START"; diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 8be89a245..6e220293a 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -2,12 +2,12 @@ // Copyright (C) 2021 Contributors to the SLS Detector Package /** API versions */ #define RELEASE "developer" -#define APICTB "developer 0x221108" -#define APIGOTTHARD "developer 0x221108" -#define APIGOTTHARD2 "developer 0x221108" -#define APIMYTHEN3 "developer 0x221108" -#define APIMOENCH "developer 0x221108" #define APIEIGER "developer 0x221108" #define APILIB "developer 0x221108" #define APIRECEIVER "developer 0x221108" -#define APIJUNGFRAU "developer 0x221118" +#define APICTB "developer 0x221124" +#define APIGOTTHARD "developer 0x221124" +#define APIGOTTHARD2 "developer 0x221124" +#define APIJUNGFRAU "developer 0x221124" +#define APIMYTHEN3 "developer 0x221124" +#define APIMOENCH "developer 0x221124"