diff --git a/slsDetectorServers/compileAllServers.sh b/slsDetectorServers/compileAllServers.sh new file mode 100644 index 000000000..831d4fd05 --- /dev/null +++ b/slsDetectorServers/compileAllServers.sh @@ -0,0 +1,43 @@ +if [ $# -eq 0 ]; then + declare -a det=("ctbDetectorServer" + "gotthardDetectorServer" + "gotthard2DetectorServer" + "jungfrauDetectorServer" + "mythen3DetectorServer" + ) +else + declare -a det=("${1}") + echo "got something" +fi + +declare -a deterror=("OK" "OK" "OK" "OK") + +for ((i=0;i<${#det[@]};++i)) +do + dir=${det[i]} + file="${det[i]}_developer" + echo -e "Compiling $dir [$file]" + cd $dir + make clean + if make ; then + deterror[i]="OK" + else + deterror[i]="FAIL" + fi + + mv bin/$dir bin/$file + git add -f bin/$file + cp bin/$file /tftpboot/ + cd .. + echo -e "\n\n" +done + +echo -e "Results:" +for ((i=0;i<${#det[@]};++i)) +do + printf "%s\t\t= %s\n" "${det[i]}" "${deterror[i]}" +done + + + + diff --git a/slsDetectorServers/compileEigerServer.sh b/slsDetectorServers/compileEigerServer.sh new file mode 100644 index 000000000..9a0c877fe --- /dev/null +++ b/slsDetectorServers/compileEigerServer.sh @@ -0,0 +1,30 @@ +declare -a det=("eigerDetectorServer") + +declare -a deterror=("OK" "OK" "OK" "OK") + +for ((i=0;i<${#det[@]};++i)) +do + dir=${det[i]} + file="${det[i]}_developer" + echo -e "Compiling $dir [$file]" + cd $dir + make clean + if make ; then + deterror[i]="OK" + else + deterror[i]="FAIL" + fi + + mv bin/$dir bin/$file + git add -f bin/$file + cp bin/$file /tftpboot/ + cd .. + echo -e "\n\n" +done + +echo -e "Results:" +for ((i=0;i<${#det[@]};++i)) +do + printf "%s\t\t= %s\n" "${det[i]}" "${deterror[i]}" +done + diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer index bf5f1142c..317f9e101 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 d19380b44..a2e882344 100755 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c @@ -86,10 +86,7 @@ void basictests() { "Could not map to memory. Dangerous to continue.\n"); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; - return; } - initCheckDone = 1; return; #else @@ -100,7 +97,6 @@ void basictests() { "Could not map to memory. Dangerous to continue.\n"); FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -110,7 +106,6 @@ void basictests() { "Could not pass basic tests of FPGA and bus. Dangerous to continue.\n"); FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -151,7 +146,6 @@ void basictests() { // return if flag is not zero, debug mode if (debugflag) { - initCheckDone = 1; return; } @@ -163,7 +157,6 @@ void basictests() { "Cant read versions from FPGA. Please update firmware.\n"); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -176,7 +169,6 @@ void basictests() { (long long int)REQRD_FRMWR_VRSN); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -189,11 +181,9 @@ void basictests() { (long long int)REQRD_FRMWR_VRSN); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } FILE_LOG(logINFO, ("\tCompatibility - success\n")); - initCheckDone = 1; #endif } @@ -420,7 +410,10 @@ uint32_t getDetectorIP(){ /* initialization */ void initControlServer(){ - setupDetector(); + if (initError == OK) { + setupDetector(); + } + initCheckDone = 1; } void initStopServer() { diff --git a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer index 7916d3871..e41ce7dce 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 3baf36dec..e11477dbb 100755 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c @@ -139,12 +139,10 @@ void basictests() { udpDetails.srcmac = macadd; #ifdef VIRTUAL - initCheckDone = 1; return; #endif // return if debugflag is not zero, debug mode if (debugflag) { - initCheckDone = 1; return; } @@ -153,7 +151,6 @@ void basictests() { strcpy(initErrorMessage, "Cant read versions from FPGA. Please update firmware.\n"); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -165,7 +162,6 @@ void basictests() { (long long int)REQUIRED_FIRMWARE_VERSION); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -177,11 +173,9 @@ void basictests() { (long long int)REQUIRED_FIRMWARE_VERSION); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } FILE_LOG(logINFO, ("Compatibility - success\n")); - initCheckDone = 1; } @@ -292,27 +286,32 @@ u_int32_t getDetectorIP() { void initControlServer() { #ifdef VIRTUAL - getModuleConfiguration(); - setupDetector(); - return; -#else - //Feb and Beb Initializations - getModuleConfiguration(); - Feb_Interface_FebInterface(); - Feb_Control_FebControl(); - Feb_Control_Init(master,top,normal, getDetectorNumber()); - //master of 9M, check high voltage serial communication to blackfin - if (master && !normal) { - if (Feb_Control_OpenSerialCommunication()) - ;// Feb_Control_CloseSerialCommunication(); + if (initError == OK) { + getModuleConfiguration(); + setupDetector(); } - FILE_LOG(logDEBUG1, ("Control server: FEB Initialization done\n")); - Beb_Beb(detid); - Beb_SetDetectorNumber(getDetectorNumber()); - FILE_LOG(logDEBUG1, ("Control server: BEB Initialization done\n")); + initCheckDone = 1; + return; +#else + if (initError == OK) { + //Feb and Beb Initializations + getModuleConfiguration(); + Feb_Interface_FebInterface(); + Feb_Control_FebControl(); + Feb_Control_Init(master,top,normal, getDetectorNumber()); + //master of 9M, check high voltage serial communication to blackfin + if (master && !normal) { + if (Feb_Control_OpenSerialCommunication()) + ;// Feb_Control_CloseSerialCommunication(); + } + FILE_LOG(logDEBUG1, ("Control server: FEB Initialization done\n")); + Beb_Beb(detid); + Beb_SetDetectorNumber(getDetectorNumber()); + FILE_LOG(logDEBUG1, ("Control server: BEB Initialization done\n")); - - setupDetector(); + setupDetector(); + } + initCheckDone = 1; #endif } diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer index 00eac1073..5cfff1d29 100755 Binary files a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer differ diff --git a/slsDetectorServers/gotthard2DetectorServer/config.txt b/slsDetectorServers/gotthard2DetectorServer/config.txt new file mode 100755 index 000000000..bb41abf22 --- /dev/null +++ b/slsDetectorServers/gotthard2DetectorServer/config.txt @@ -0,0 +1,23 @@ +#onchip dacs chip index value +vchip_comp_fe -1 0x137 +vchip_opa_1st -1 0x000 +vchip_opa_fd -1 0x134 +vchip_comp_adc -1 0x3FF +vchip_ref_comp_fe -1 0x100 +vchip_cs -1 0x0D0 + +#dacs +vref_h_adc 2099 +vb_comp_fe 0 +vb_comp_adc 0 +vcom_cds 1400 +vref_restore 640 +vb_opa_1st 0 +vref_comp_fe 0 +vcom_adc1 1400 +vref_prech 1720 +vref_l_adc 700 +vref_cds 1200 +vb_cs 2799 +vb_opa_fd 0 +vcom_adc2 1400 diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index 007cb23fb..57258fb84 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -38,7 +38,9 @@ int32_t clkPhase[NUM_CLOCKS] = {0, 0, 0, 0, 0, 0}; uint32_t clkFrequency[NUM_CLOCKS] = {0, 0, 0, 0, 0, 0}; int highvoltage = 0; int dacValues[NDAC] = {0}; -int onChipdacValues[ONCHIP_NDAC][NCHIP + 1] = {0}; +int onChipdacValues[ONCHIP_NDAC][NCHIP] = {0}; +int defaultDacValues[NDAC] = {0}; +int defaultOnChipdacValues[ONCHIP_NDAC][NCHIP] = {0}; int detPos[2] = {0, 0}; int isInitCheckDone() { @@ -61,10 +63,8 @@ void basictests() { "Could not map to memory. Dangerous to continue.\n"); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } - initCheckDone = 1; return; #else if (mapCSP0() == FAIL) { @@ -72,7 +72,6 @@ void basictests() { "Could not map to memory. Dangerous to continue.\n"); FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } // does check only if flag is 0 (by default), set by command line @@ -81,7 +80,6 @@ void basictests() { "Could not pass basic tests of FPGA and bus. Dangerous to continue. (Firmware version:0x%llx) \n", getFirmwareVersion()); FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -118,7 +116,6 @@ void basictests() { // return if flag is not zero, debug mode if (debugflag) { - initCheckDone = 1; return; } @@ -129,7 +126,6 @@ void basictests() { "Cant read versions from FPGA. Please update firmware.\n"); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -142,7 +138,6 @@ void basictests() { (long long int)requiredFirmwareVersion); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -155,11 +150,10 @@ void basictests() { (long long int)requiredFirmwareVersion); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } FILE_LOG(logINFO, ("Compatibility - success\n")); - initCheckDone = 1; + #endif } @@ -311,7 +305,10 @@ u_int32_t getDetectorIP(){ /* initialization */ void initControlServer(){ - setupDetector(); + if (initError == OK) { + setupDetector(); + } + initCheckDone = 1; } void initStopServer() { @@ -347,7 +344,7 @@ void setupDetector() { dacValues[i] = 0; } for (i = 0; i < ONCHIP_NDAC; ++i) { - for (j = 0; j < NCHIP + 1; ++j) + for (j = 0; j < NCHIP; ++j) onChipdacValues[i][j] = -1; } } @@ -368,8 +365,7 @@ void setupDetector() { // Default values setHighVoltage(DEFAULT_HIGH_VOLTAGE); - setDefaultDacs(); - setDefaultOnChipDacs(); + readConfigFile(); // also sets default dac and on chip dac values // Initialization of acquistion parameters setNumFrames(DEFAULT_NUM_FRAMES); @@ -382,10 +378,9 @@ int setDefaultDacs() { int ret = OK; FILE_LOG(logINFOBLUE, ("Setting Default Dac values\n")); { - int i = 0; - const int defaultvals[NDAC] = DEFAULT_DAC_VALS; - for(i = 0; i < NDAC; ++i) { - setDAC((enum DACINDEX)i,defaultvals[i],0); + int idac = 0; + for(idac = 0; idac < NDAC; ++idac) { + setDAC((enum DACINDEX)idac, defaultDacValues[idac], 0); } } return ret; @@ -395,16 +390,161 @@ int setDefaultOnChipDacs() { int ret = OK; FILE_LOG(logINFOBLUE, ("Setting Default On chip Dac values\n")); { - int i = 0; - const int defaultOnChipVals[ONCHIP_NDAC] = DEFAULT_ONCHIP_DAC_VALS; - for(i = 0; i < ONCHIP_NDAC; ++i) { - setOnChipDAC((enum ONCHIP_DACINDEX)i, -1, defaultOnChipVals[i]); + int idac = 0, ichip = 0; + for(idac = 0; idac < ONCHIP_NDAC; ++idac) { + for(ichip = 0; ichip < NCHIP; ++ichip) { + setOnChipDAC((enum ONCHIP_DACINDEX)idac, ichip, defaultOnChipdacValues[idac][ichip]); + } } } return ret; } +int readConfigFile() { + + if (initError == FAIL) { + return initError; + } + + FILE* fd = fopen(CONFIG_FILE, "r"); + if(fd == NULL) { + sprintf(initErrorMessage, "Could not open on-board detector server config file [%s].\n", CONFIG_FILE); + initError = FAIL; + FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + return FAIL; + } + + FILE_LOG(logINFOBLUE, ("Reading config file %s\n", CONFIG_FILE)); + + // Initialization + const size_t LZ = 256; + char line[LZ]; + memset(line, 0, LZ); + char command[LZ]; + + // keep reading a line + while (fgets(line, LZ, fd)) { + + // ignore comments + if (line[0] == '#') { + FILE_LOG(logDEBUG1, ("Ignoring Comment\n")); + continue; + } + + // ignore empty lines + if (strlen(line) <= 1) { + FILE_LOG(logDEBUG1, ("Ignoring Empty line\n")); + continue; + } + + FILE_LOG(logDEBUG1, ("Command to process: (size:%d) %s\n", strlen(line), line)); + memset(command, 0, LZ); + + // vchip command + if (!strncmp(line, "vchip_", strlen("vchip_"))) { + + enum ONCHIP_DACINDEX idac = 0; + int ichip = -1; + int value = 0; + + // cannot scan values + if (sscanf(line, "%s %d 0x%x", command, &ichip, &value) != 3) { + sprintf(initErrorMessage, "Could not scan on-chip dac commands from on-board server config file. Line:[%s].\n", line); + break; + } + + if (!strcmp(command,"vchip_comp_fe")) { + idac = G2_VCHIP_COMP_FE; + } else if (!strcasecmp(command,"vchip_opa_1st")) { + idac = G2_VCHIP_OPA_1ST; + } else if (!strcasecmp(command,"vchip_opa_fd")) { + idac = G2_VCHIP_OPA_FD; + } else if (!strcasecmp(command,"vchip_comp_adc")) { + idac = G2_VCHIP_COMP_ADC; + } else if (!strcasecmp(command,"vchip_ref_comp_fe")) { + idac = G2_VCHIP_REF_COMP_FE; + } else if (!strcasecmp(command,"vchip_cs")) { + idac = G2_VCHIP_CS; + } else { + sprintf(initErrorMessage, "Unknown on-chip dac command in on-board server config file. Command:[%s].\n", command); + break; + } + + // set on chip dac + if (setOnChipDAC(idac, ichip, value) == FAIL) { + sprintf(initErrorMessage, "Set on-chip dac failed from on-board server config file. Command:[%s].\n", command); + break; + } + } + + // dac command + else { + + enum DACINDEX idac = 0; + int value = 0; + + // cannot scan values + if (sscanf(line, "%s %d", command, &value) != 2) { + sprintf(initErrorMessage, "Could not scan dac commands from on-board server config file. Line:[%s].\n", line); + break; + } + + if (!strcmp(command,"vref_h_adc")) { + idac = G2_VREF_H_ADC; + } else if (!strcasecmp(command,"vb_comp_fe")) { + idac = G2_VB_COMP_FE; + } else if (!strcasecmp(command,"vb_comp_adc")) { + idac = G2_VB_COMP_ADC; + } else if (!strcasecmp(command,"vcom_cds")) { + idac = G2_VCOM_CDS; + } else if (!strcasecmp(command,"vref_restore")) { + idac = G2_VREF_RESTORE; + } else if (!strcasecmp(command,"vb_opa_1st")) { + idac = G2_VB_OPA_1ST; + } else if (!strcasecmp(command,"vref_comp_fe")) { + idac = G2_VREF_COMP_FE; + } else if (!strcasecmp(command,"vcom_adc1")) { + idac = G2_VCOM_ADC1; + } else if (!strcasecmp(command,"vref_prech")) { + idac = G2_VREF_PRECH; + } else if (!strcasecmp(command,"vref_l_adc")) { + idac = G2_VREF_L_ADC; + } else if (!strcasecmp(command,"vref_cds")) { + idac = G2_VREF_CDS; + } else if (!strcasecmp(command,"vb_cs")) { + idac = G2_VB_CS; + } else if (!strcasecmp(command,"vb_opa_fd")) { + idac = G2_VB_OPA_FD; + } else if (!strcasecmp(command,"vcom_adc2")) { + idac = G2_VCOM_ADC2; + } else { + sprintf(initErrorMessage, "Unknown command in on-board server config file. Command:[%s].\n", command); + break; + } + + // set dac + setDAC(idac, value, 0); + int retval = getDAC(idac, 0); + if (retval != value) { + sprintf(initErrorMessage, "Set dac %s failed from on-board server config file. Set %d, got %d.\n", command, value, retval); + break; + } + } + memset(line, 0, LZ); + } + fclose(fd); + + if (strlen(initErrorMessage)) { + initError = FAIL; + FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + } else { + FILE_LOG(logINFOBLUE, ("Successfully read config file\n")); + } + return initError; +} + + /* set parameters - dr, roi */ int setDynamicRange(int dr){ @@ -506,6 +646,8 @@ int setOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex, int val) { FILE_LOG(logERROR, ("Invalid val %d\n", val)); return FAIL; } + FILE_LOG(logINFO, ("Setting on chip dac[%d - %s]: 0x%x\n", (int)ind, names[ind], val)); + char buffer[2]; buffer[1] = ((val & 0xF) << 4) | (((int)ind) & 0xF); // LSB (4 bits) + ADDR (4 bits) @@ -514,18 +656,36 @@ int setOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex, int val) { if (ASIC_Driver_Set(chipIndex, sizeof(buffer), buffer) == FAIL) { return FAIL; } - onChipdacValues[ind][chipIndex + 1] = val; + // all chips if (chipIndex == -1) { - int i; - for (i = 1; i < NCHIP + 1; ++i) { - onChipdacValues[ind][i] = val; + int ichip = 0; + for (ichip = 0; ichip < NCHIP; ++ichip) { + onChipdacValues[ind][ichip] = val; } + } + + // specific chip + else { + onChipdacValues[ind][chipIndex] = val; } return OK; } int getOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex) { - return onChipdacValues[ind][chipIndex + 1]; + // all chips + if (chipIndex == -1) { + int retval = onChipdacValues[ind][0]; + int ichip = 0; + // check if same value for remaining chips + for (ichip = 1; ichip < NCHIP; ++ichip) { + if (onChipdacValues[ind][ichip] != retval) { + return -1; + } + } + return retval; + } + // specific chip + return onChipdacValues[ind][chipIndex]; } void setDAC(enum DACINDEX ind, int val, int mV) { diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h index 052d3a499..2672a7c85 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h @@ -16,6 +16,7 @@ #define HV_DRIVER_FILE_NAME ("/etc/devlinks/hvdac") #define DAC_DRIVER_FILE_NAME ("/etc/devlinks/dac") #define ONCHIP_DAC_DRIVER_FILE_NAME ("/etc/devlinks/chipdac") +#define CONFIG_FILE ("config.txt") #define DAC_MAX_MV (2048) #define ONCHIP_DAC_MAX_VAL (0x3FF) @@ -60,23 +61,6 @@ enum DACINDEX {G2_VREF_H_ADC, /* 0 */ \ G2_VCOM_ADC2 /* 15*/ \ }; #define DAC_NAMES "vref_h_adc", "dac_unused", "vb_comp_fe", "vb_comp_adc", "vcom_cds", "vref_restore", "vb_opa_1st", "vref_comp_fe", "vcom_adc1", "vref_prech", "vref_l_adc", "vref_cds", "vb_cs", "vb_opa_fd", "dac_unused2", "vcom_adc2" -#define DEFAULT_DAC_VALS {2099, /* 0 (1050 mV) VREF_H_ADC*/ \ - 0, /* 1 (0 mV) DAC_UNUSED*/ \ - 0, /* 2 (0 mV) VB_COMP_FE*/ \ - 0, /* 3 (0 mV) VB_COMP_ADC*/ \ - 1400, /* 4 (700 mV) VCOM_CDS*/ \ - 640, /* 5 (320 mV) VREF_RESTORE*/ \ - 0, /* 6 (0 mV) VB_OPA_1ST*/ \ - 0, /* 7 (0 mV) VREF_COMP_FE*/ \ - 1400, /* 8 (700 mV) VCOM_ADC1*/ \ - 1720, /* 9 (860 mV) VREF_PRECH*/ \ - 700, /* 10 (350 mV) VREF_L_ADC*/ \ - 1200, /* 11 (600 mV) VREF_CDS*/ \ - 2799, /* 12 (1400 mV) VB_CS*/ \ - 0, /* 13 (0 mV) VB_OPA_FD*/ \ - 0, /* 14 (0 mV) DAC_UNUSED2*/ \ - 1400 /* 15 (700 mV) VCOM_ADC2*/ \ - }; enum ONCHIP_DACINDEX {G2_VCHIP_COMP_FE, /* 0 */ \ G2_VCHIP_OPA_1ST, /* 1 */ \ @@ -87,13 +71,6 @@ enum ONCHIP_DACINDEX {G2_VCHIP_COMP_FE, /* 0 */ \ }; #define ONCHIP_DAC_NAMES "vchip_comp_fe", "vchip_opa_1st", "vchip_opa_fd", "vchip_comp_adc", "vchip_ref_comp_fe", "vchip_cs" -#define DEFAULT_ONCHIP_DAC_VALS {0x137, /* 0 G2_VCHIP_COMP_FE*/ \ - 0x000, /* 1 G2_VCHIP_OPA_1ST*/ \ - 0x134, /* 2 G2_VCHIP_OPA_FD*/ \ - 0x3FF, /* 3 G2_VCHIP_COMP_ADC*/ \ - 0x100, /* 4 G2_VCHIP_REF_COMP_FE*/ \ - 0x0D0 /* 5 G2_VCHIP_CS*/ \ - }; enum CLKINDEX {READOUT_C0, READOUT_C1, SYSTEM_C0, SYSTEM_C1, SYSTEM_C2, SYSTEM_C3, NUM_CLOCKS}; #define CLK_NAMES "READOUT_C0", "READOUT_C1", "SYSTEM_C0", "SYSTEM_C1", "SYSTEM_C2", "SYSTEM_C3" diff --git a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer index 92a446064..71c6955fc 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 49b2337e7..14202567a 100755 --- a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c @@ -73,10 +73,7 @@ void basictests() { "Could not map to memory. Dangerous to continue.\n"); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; - return; } - initCheckDone = 1; return; #else if (mapCSP0() == FAIL) { @@ -84,7 +81,6 @@ void basictests() { "Could not map to memory. Dangerous to continue.\n"); FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -94,7 +90,6 @@ void basictests() { "Could not pass basic tests of FPGA and bus. Dangerous to continue.\n"); FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -126,7 +121,6 @@ void basictests() { )); FILE_LOG(logINFO, ("Basic Tests - success\n")); - initCheckDone = 1; #endif } @@ -343,7 +337,10 @@ u_int32_t getBoardRevision() { /* initialization */ void initControlServer(){ - setupDetector(); + if (initError == OK) { + setupDetector(); + } + initCheckDone = 1; } void initStopServer() { diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer index eddf4703a..38441123d 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 c02eb3579..e513855a1 100755 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -63,10 +63,7 @@ void basictests() { "Could not map to memory. Dangerous to continue.\n"); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; - return; } - initCheckDone = 1; return; #else @@ -77,7 +74,6 @@ void basictests() { "Could not map to memory. Dangerous to continue.\n"); FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -87,7 +83,6 @@ void basictests() { "Could not pass basic tests of FPGA and bus. Dangerous to continue.\n"); FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -129,7 +124,6 @@ void basictests() { // return if flag is not zero, debug mode if (debugflag) { - initCheckDone = 1; return; } @@ -141,7 +135,6 @@ void basictests() { "Cant read versions from FPGA. Please update firmware.\n"); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -154,7 +147,6 @@ void basictests() { (long long int)requiredFirmwareVersion); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -167,11 +159,9 @@ void basictests() { (long long int)requiredFirmwareVersion); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } FILE_LOG(logINFO, ("Compatibility - success\n")); - initCheckDone = 1; #endif } @@ -347,7 +337,10 @@ u_int32_t getDetectorIP(){ /* initialization */ void initControlServer(){ - setupDetector(); + if (initError == OK) { + setupDetector(); + } + initCheckDone = 1; } diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer index 476e96cae..60b4b4587 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 bc8dfbb78..0bd5fd2d4 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -60,10 +60,7 @@ void basictests() { "Could not map to memory. Dangerous to continue.\n"); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; - return; } - initCheckDone = 1; return; #else FILE_LOG(logINFOBLUE, ("******** Mythen3 Server: do the checks *****************\n")); @@ -72,7 +69,6 @@ void basictests() { "Could not map to memory. Dangerous to continue.\n"); FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } // does check only if flag is 0 (by default), set by command line @@ -81,7 +77,6 @@ void basictests() { "Could not pass basic tests of FPGA and bus. Dangerous to continue.\n"); FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } uint16_t hversion = getHardwareVersionNumber(); @@ -120,7 +115,6 @@ void basictests() { // return if flag is not zero, debug mode if (debugflag) { - initCheckDone = 1; return; } @@ -132,7 +126,6 @@ void basictests() { "Cant read versions from FPGA. Please update firmware.\n"); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -145,7 +138,6 @@ void basictests() { (long long int)requiredFirmwareVersion); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } @@ -158,11 +150,9 @@ void basictests() { (long long int)requiredFirmwareVersion); FILE_LOG(logERROR, (initErrorMessage)); initError = FAIL; - initCheckDone = 1; return; } FILE_LOG(logINFO, ("Compatibility - success\n")); - initCheckDone = 1; #endif } @@ -315,7 +305,10 @@ u_int32_t getDetectorIP(){ /* initialization */ void initControlServer(){ - setupDetector(); + if (initError == OK) { + setupDetector(); + } + initCheckDone = 1; } void initStopServer() { diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h index cf4047f5a..438569393 100755 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h @@ -89,6 +89,7 @@ int setDefaultDacs(); #endif #ifdef GOTTHARD2D int setDefaultOnChipDacs(); +int readConfigFile(); #endif @@ -123,6 +124,7 @@ int readConfigFile(); void setMasterSlaveConfiguration(); #endif + // parameters - dr, roi int setDynamicRange(int dr); #ifdef GOTTHARDD diff --git a/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c b/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c index c478b70fb..b6d4816e2 100755 --- a/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c +++ b/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c @@ -26,20 +26,22 @@ void ASIC_Driver_SetDefines(char* driverfname) { } int ASIC_Driver_Set (int index, int length, char* buffer) { - FILE_LOG(logDEBUG1, ("\tchip index: %d length: %d\n", index, length)); - - { - FILE_LOG(logDEBUG1, ("\tvalues:\n")); - int i; - for (i = 0; i < length; ++i) { - FILE_LOG(logDEBUG1, ("\t\t0x%02hhx\n", buffer[i])); - } - FILE_LOG(logDEBUG1, ("\n")); - } - char fname[MAX_STR_LENGTH]; sprintf(fname, "%s%d", ASIC_Driver_DriverFileName, index + 1); - FILE_LOG(logDEBUG1, ("fname %s\n",fname)); + FILE_LOG(logDEBUG1, ("\t[chip index: %d, length: %d, fname: %s]\n", index, length, fname)); + { + char printbuffer[2 * length + 15]; + memset(printbuffer, 0, 2 * length); + strcpy(printbuffer, "\t values: ["); + int i; + for (i = 0; i < length; ++i) { + char bytes[10]=""; + sprintf(bytes, "\t0x%02hhx", buffer[i]); + strcat(printbuffer, bytes); + } + strcat(printbuffer, "]"); + FILE_LOG(logDEBUG1, ("%s\n", printbuffer)); + } int fd=open(fname, O_RDWR); if (fd == -1) { diff --git a/slsSupportLib/include/versionAPI.h b/slsSupportLib/include/versionAPI.h index 52cc25f1c..6be628067 100644 --- a/slsSupportLib/include/versionAPI.h +++ b/slsSupportLib/include/versionAPI.h @@ -6,7 +6,7 @@ #define APIMOENCH 0x190820 #define APICTB 0x191111 #define APIGOTTHARD 0x191111 -#define APIGOTTHARD2 0x191111 -#define APIMYTHEN3 0x191111 #define APIJUNGFRAU 0x191111 +#define APIMYTHEN3 0x191111 #define APIEIGER 0x191111 +#define APIGOTTHARD2 0x191111