From b3393fc18b2546a0ea54de3f813079b331fcbb6f Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 4 Dec 2018 16:02:24 +0100 Subject: [PATCH] few gotthard bug fixes, including cs mask for adc --- .../gotthardDetectorServer/RegisterDefs.h | 2 +- .../slsDetectorFunctionList.c | 21 ++++++++++--------- slsDetectorServers/slsDetectorServer/AD9252.h | 2 +- slsDetectorServers/slsDetectorServer/AD9257.h | 3 ++- .../slsDetectorServer_funcs.c | 18 ++++++++-------- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h b/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h index 299fd6c2d..6e27f65a1 100755 --- a/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h +++ b/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h @@ -88,7 +88,7 @@ #define ADC_SERIAL_DATA_OUT_OFST (1) #define ADC_SERIAL_DATA_OUT_MSK (0x00000001 << ADC_SERIAL_DATA_OUT_OFST) #define ADC_SERIAL_CS_OUT_OFST (2) -#define ADC_SERIAL_CS_OUT_MSK (0x0000000F << ADC_SERIAL_CS_OUT_OFST) +#define ADC_SERIAL_CS_OUT_MSK (0x0000001F << ADC_SERIAL_CS_OUT_OFST) /** ADC Sync register */ #define ADC_SYNC_REG (0x19 << MEM_MAP_SHIFT) diff --git a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c index 3a8a042fd..babb7cc88 100644 --- a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c @@ -105,16 +105,16 @@ void basictests() { int64_t client_sw_apiversion = getDetectorId(CLIENT_SOFTWARE_API_VERSION); FILE_LOG(logINFOBLUE, ("************ Gotthard Server *********************\n" - "Board Revision:\t\t 0x%x\n" + "Board Revision : 0x%x\n" - "Detector IP Addr:\t\t 0x%x\n" - "Detector MAC Addr:\t\t 0x%llx\n\n" + "Detector IP Addr : 0x%x\n" + "Detector MAC Addr : 0x%llx\n\n" - "Firmware Version:\t\t 0x%llx\n" - "Software Version:\t\t 0x%llx\n" - "F/w-S/w API Version:\t\t 0x%llx\n" - "Required Firmware Version:\t 0x%x\n" - "Client-Software API Version:\t 0x%llx\n" + "Firmware Version : 0x%llx\n" + "Software Version : 0x%llx\n" + "F/w-S/w API Version : 0x%llx\n" + "Required F/w Version : 0x%x\n" + "Client-S/w API Version : 0x%llx\n" "********************************************************\n", boardrev, ipadd, @@ -372,11 +372,12 @@ void setupDetector() { // Initialization setPhaseShiftOnce(); + /* FIXME: (also check with commenting out #define GOTTHARDD in ad9257.h), check if need to replace with configureADC from firmwarE_funcs.c? */ if (getBoardRevision() == 1) - prepareADC9252(); /* FIXME: (also check with commenting out #define GOTTHARDD in ad9257.h), check if need to replace with configureADC from firmwarE_funcs.c? */ + prepareADC9252(); else prepareADC9257(); - configureADC(); + //configureADC(); setROIADC(-1); // set adcsyncreg, daqreg, chipofinterestreg, cleanfifos, setGbitReadout(); initDac(0); /*FIXME: if it doesnt work, switch to the old dac*/ diff --git a/slsDetectorServers/slsDetectorServer/AD9252.h b/slsDetectorServers/slsDetectorServer/AD9252.h index 0cb4fb0d6..ddb0c4518 100755 --- a/slsDetectorServers/slsDetectorServer/AD9252.h +++ b/slsDetectorServers/slsDetectorServer/AD9252.h @@ -112,7 +112,7 @@ void setAdc9252(int addr, int val) { } void prepareADC9252(){ - FILE_LOG(logINFOBLUE, ("Preparing ADC:\n")); + FILE_LOG(logINFOBLUE, ("Preparing ADC9252:\n")); //power mode reset FILE_LOG(logINFO, ("\tPower mode reset\n")); diff --git a/slsDetectorServers/slsDetectorServer/AD9257.h b/slsDetectorServers/slsDetectorServer/AD9257.h index ad471a2d7..c55b4a8f3 100755 --- a/slsDetectorServers/slsDetectorServer/AD9257.h +++ b/slsDetectorServers/slsDetectorServer/AD9257.h @@ -143,7 +143,7 @@ void setAdc9257(int addr, int val) { } void prepareADC9257(){ - FILE_LOG(logINFOBLUE, ("Preparing ADC:\n")); + FILE_LOG(logINFOBLUE, ("Preparing ADC9257:\n")); //power mode reset FILE_LOG(logINFO, ("\tPower mode reset\n")); @@ -192,4 +192,5 @@ void prepareADC9257(){ FILE_LOG(logINFO, ("\tMixed bit frequency test mode\n")); setAdc9257(AD9257_TEST_MODE_REG, AD9257_TST_MXD_BT_FRQ_VAL); #endif + } diff --git a/slsDetectorServers/slsDetectorServer/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/slsDetectorServer_funcs.c index acbb6ba32..d1fe3b66a 100755 --- a/slsDetectorServers/slsDetectorServer/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/slsDetectorServer_funcs.c @@ -1496,7 +1496,7 @@ int set_timer(int file_des) { return printSocketReadError(); enum timerIndex ind = (int)args[0]; int64_t tns = args[1]; - char timerName[20] = {0}; + char timerName[50] = {0}; strcpy(timerName, getTimerName(ind)); #ifdef EIGERD int64_t subexptime = 0; @@ -1562,15 +1562,16 @@ int set_timer(int file_des) { } // validate - sprintf(timerName, "set %s", timerName); + char vtimerName[50] = {0}; + sprintf(vtimerName, "set %s", timerName); #ifdef EIGERD - validate64(tns, retval, timerName, DEC); // copied to server, not read from detector register + validate64(tns, retval, vtimerName, DEC); // copied to server, not read from detector register #else switch(ind) { case FRAME_NUMBER: case CYCLES_NUMBER: case STORAGE_CELL_NUMBER: - validate64(tns, retval, timerName, DEC); // no conversion, so all good + validate64(tns, retval, vtimerName, DEC); // no conversion, so all good break; case SAMPLES_JCTB: if (retval == -1) { @@ -1580,7 +1581,7 @@ int set_timer(int file_des) { (long long unsigned int)tns); FILE_LOG(logERROR,(mess)); } else - validate64(tns, retval, timerName, DEC); // no conversion, so all good + validate64(tns, retval, vtimerName, DEC); // no conversion, so all good case ACQUISITION_TIME: case FRAME_PERIOD: case DELAY_AFTER_TRIGGER: @@ -1589,7 +1590,7 @@ int set_timer(int file_des) { // losing precision due to conversion to clock (also gotthard master delay is different) if (validateTimer(ind, tns, retval) == FAIL) { ret = FAIL; - sprintf(mess, "Could not %s. Set %lld, but read %lld\n", timerName, + sprintf(mess, "Could not %s. Set %lld, but read %lld\n", vtimerName, (long long unsigned int)tns, (long long unsigned int)retval); FILE_LOG(logERROR,(mess)); } @@ -1823,7 +1824,7 @@ int set_roi(int file_des) { } } -#if !defined(GOTTHARDD) || !defined(CHIPTESTBOARDD) +#if !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) functionNotImplemented(); #else // set & get @@ -1838,8 +1839,7 @@ int set_roi(int file_des) { if (nretval == -1) // chip test board sprintf(mess,"Could not set ROI. Max ROI level (100) reached!\n"); else if (nretval == -2) - sprintf(mess, "Could not set ROI. Could not allocate RAM\n", - (long long unsigned int)tns); + sprintf(mess, "Could not set ROI. Could not allocate RAM\n"); else sprintf(mess,"Could not set all roi. " "Set %d rois, but read %d rois\n", narg, nretval);