diff --git a/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h b/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h index 820ba4420..28dd50d34 100644 --- a/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h +++ b/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h @@ -102,9 +102,13 @@ #define CONFIG_VETO_CH_10GBE_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_10GBE_ENBL_OFST) #define CONFIG_SLAVE_OFST (16) #define CONFIG_SLAVE_MSK (0x00000001 << CONFIG_SLAVE_OFST) -#define CONFIG_HDI_MOD_ID_OFST (17) -#define CONFIG_HDI_MOD_ID_MSK (0x00000007 << CONFIG_HDI_MOD_ID_OFST) -#define CONFIG_FLIP_DATA_STREAM_OFST (20) +#define CONFIG_HDI_SLAVE_OFST (17) +#define CONFIG_HDI_SLAVE_MSK (0x00000001 << CONFIG_HDI_SLAVE_OFST) +#define CONFIG_HDI_VERSION_OFST (18) +#define CONFIG_HDI_VERSION_MSK (0x0000001F << CONFIG_HDI_VERSION_OFST) +#define CONFIG_HDI_25UM_OFST (23) +#define CONFIG_HDI_25UM_MSK (0x00000001 << CONFIG_HDI_25UM_OFST) +#define CONFIG_FLIP_DATA_STREAM_OFST (24) #define CONFIG_FLIP_DATA_STREAM_MSK (0x00000001 << CONFIG_FLIP_DATA_STREAM_OFST) #define ALGORITHM_HITS_VAL (0x0) #define ALGORITHM_RAW_VAL (0x7) diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer index ddc2e4b7b..a36a4c797 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 8c5159be0..0bd9929d3 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -2029,48 +2029,73 @@ int checkDetectorType(char *mess) { LOG(logERROR, (mess)); return FAIL; } - int type = atoi(buffer); - enum MASTERINDEX master = OW_MASTER; - if (abs(type - TYPE_GOTTHARD2_25UM_MASTER_HD1_V1_VAL) <= TYPE_TOLERANCE) { - LOG(logINFOBLUE, ("MASTER 25um Module (HDI v1.0)\n")); - } else if (abs(type - TYPE_GOTTHARD2_25UM_MASTER_HD1_V2_VAL) <= - TYPE_TOLERANCE) { - LOG(logINFOBLUE, ("MASTER 25um Module (HDI v2.0)\n")); - } else if (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_HDI_V1_VAL) <= - TYPE_TOLERANCE) { - LOG(logINFOBLUE, ("SLAVE 25um Module (HDI v1.0)\n")); - master = OW_SLAVE; - } else if (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_HDI_V2_VAL) <= - TYPE_TOLERANCE) { - LOG(logINFOBLUE, ("SLAVE 25um Module (HDI v2.0)\n")); - master = OW_SLAVE; - } else if (abs(type - TYPE_GOTTHARD2_MODULE_VAL) <= TYPE_TOLERANCE) { - LOG(logINFOBLUE, ("50um Module\n")); + + { + int type = atoi(buffer); + int hdiSlave = 0; + int hdiVersion = 0x1; + int hdi25um = 1; + if (abs(type - TYPE_GOTTHARD2_25UM_MASTER_HD1_V1_VAL) <= + TYPE_TOLERANCE) { + LOG(logINFOBLUE, ("MASTER 25um Module (HDI v1.0)\n")); + } else if (abs(type - TYPE_GOTTHARD2_25UM_MASTER_HD1_V2_VAL) <= + TYPE_TOLERANCE) { + LOG(logINFOBLUE, ("MASTER 25um Module (HDI v2.0)\n")); + hdiVersion = 0x2; + } else if (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_HDI_V1_VAL) <= + TYPE_TOLERANCE) { + LOG(logINFOBLUE, ("SLAVE 25um Module (HDI v1.0)\n")); + hdiSlave = 1; + } else if (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_HDI_V2_VAL) <= + TYPE_TOLERANCE) { + LOG(logINFOBLUE, ("SLAVE 25um Module (HDI v2.0)\n")); + hdiSlave = 1; + hdiVersion = 0x2; + } else if (abs(type - TYPE_GOTTHARD2_MODULE_VAL) <= TYPE_TOLERANCE) { + LOG(logINFOBLUE, ("50um Module\n")); + hdi25um = 0; + } + // no module or invalid module + else if (type > TYPE_NO_MODULE_STARTING_VAL) { + sprintf(mess, "No Module attached! Run server with -nomodule.\n"); + LOG(logERROR, (mess)); + return FAIL; + } else { + sprintf(mess, + "Wrong Module attached! Expected %d, %d, %d, %d or %d for " + "Gotthard2, got %d\n", + TYPE_GOTTHARD2_MODULE_VAL, + TYPE_GOTTHARD2_25UM_MASTER_HD1_V1_VAL, + TYPE_GOTTHARD2_25UM_SLAVE_HDI_V1_VAL, + TYPE_GOTTHARD2_25UM_MASTER_HD1_V2_VAL, + TYPE_GOTTHARD2_25UM_SLAVE_HDI_V2_VAL, type); + LOG(logERROR, (mess)); + return FAIL; + } + if (hdiSlave) { + bus_w(CONFIG_REG, bus_r(CONFIG_REG) | CONFIG_HDI_SLAVE_MSK); + } else { + bus_w(CONFIG_REG, bus_r(CONFIG_REG) & ~CONFIG_HDI_SLAVE_MSK); + } + if (hdi25um) { + bus_w(CONFIG_REG, bus_r(CONFIG_REG) | CONFIG_HDI_25UM_MSK); + } else { + bus_w(CONFIG_REG, bus_r(CONFIG_REG) & ~CONFIG_HDI_25UM_MSK); + } + bus_w(CONFIG_REG, bus_r(CONFIG_REG) & ~CONFIG_HDI_VERSION_MSK); + bus_w(CONFIG_REG, + bus_r(CONFIG_REG) | ((hdiVersion << CONFIG_HDI_VERSION_OFST) & + CONFIG_HDI_VERSION_MSK)); } - // no module or invalid module - else if (type > TYPE_NO_MODULE_STARTING_VAL) { - sprintf(mess, "No Module attached! Run server with -nomodule.\n"); - LOG(logERROR, (mess)); - return FAIL; - } else { - sprintf(mess, - "Wrong Module attached! Expected %d, %d, %d, %d or %d for " - "Gotthard2, got %d\n", - TYPE_GOTTHARD2_MODULE_VAL, - TYPE_GOTTHARD2_25UM_MASTER_HD1_V1_VAL, - TYPE_GOTTHARD2_25UM_SLAVE_HDI_V1_VAL, - TYPE_GOTTHARD2_25UM_MASTER_HD1_V2_VAL, - TYPE_GOTTHARD2_25UM_SLAVE_HDI_V2_VAL, type); - LOG(logERROR, (mess)); - return FAIL; - } - bus_w(CONFIG_REG, bus_r(CONFIG_REG) & ~CONFIG_HDI_MOD_ID_MSK); - bus_w(CONFIG_REG, bus_r(CONFIG_REG) | ((type << CONFIG_HDI_MOD_ID_OFST) & - CONFIG_HDI_MOD_ID_MSK)); - if (setMaster(master) == FAIL) { - strcpy(mess, "Could not set to master/slave."); - LOG(logERROR, (mess)); - return FAIL; + + { + enum MASTERINDEX master = + (bus_r(CONFIG_REG) & CONFIG_HDI_SLAVE_MSK) ? OW_SLAVE : OW_MASTER; + if (setMaster(master) == FAIL) { + strcpy(mess, "Could not set to master/slave."); + LOG(logERROR, (mess)); + return FAIL; + } } return OK; } diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h index c13f88540..6ccf862e0 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h @@ -3,7 +3,7 @@ #pragma once #include "sls/sls_detector_defs.h" -#define REQRD_FRMWRE_VRSN (0x220720) +#define REQRD_FRMWRE_VRSN (0x220818) #define KERNEL_DATE_VRSN "Mon May 10 18:00:21 CEST 2021" #define ID_FILE "detid_gotthard2.txt" diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 4d68ad17d..2c9492e02 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -7,8 +7,8 @@ #define APIGUI 0x220609 #define APIGOTTHARD 0x220816 #define APIEIGER 0x220816 -#define APIGOTTHARD2 0x220816 #define APIJUNGFRAU 0x220816 +#define APIGOTTHARD2 0x220818 #define APIMOENCH 0x220822 #define APIMYTHEN3 0x220822 #define APICTB 0x220822