few gotthard bug fixes, including cs mask for adc

This commit is contained in:
maliakal_d 2018-12-04 16:02:24 +01:00
parent 4e65a1d964
commit b3393fc18b
5 changed files with 24 additions and 22 deletions

View File

@ -88,7 +88,7 @@
#define ADC_SERIAL_DATA_OUT_OFST (1) #define ADC_SERIAL_DATA_OUT_OFST (1)
#define ADC_SERIAL_DATA_OUT_MSK (0x00000001 << ADC_SERIAL_DATA_OUT_OFST) #define ADC_SERIAL_DATA_OUT_MSK (0x00000001 << ADC_SERIAL_DATA_OUT_OFST)
#define ADC_SERIAL_CS_OUT_OFST (2) #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 */ /** ADC Sync register */
#define ADC_SYNC_REG (0x19 << MEM_MAP_SHIFT) #define ADC_SYNC_REG (0x19 << MEM_MAP_SHIFT)

View File

@ -105,16 +105,16 @@ void basictests() {
int64_t client_sw_apiversion = getDetectorId(CLIENT_SOFTWARE_API_VERSION); int64_t client_sw_apiversion = getDetectorId(CLIENT_SOFTWARE_API_VERSION);
FILE_LOG(logINFOBLUE, ("************ Gotthard Server *********************\n" 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 IP Addr : 0x%x\n"
"Detector MAC Addr:\t\t 0x%llx\n\n" "Detector MAC Addr : 0x%llx\n\n"
"Firmware Version:\t\t 0x%llx\n" "Firmware Version : 0x%llx\n"
"Software Version:\t\t 0x%llx\n" "Software Version : 0x%llx\n"
"F/w-S/w API Version:\t\t 0x%llx\n" "F/w-S/w API Version : 0x%llx\n"
"Required Firmware Version:\t 0x%x\n" "Required F/w Version : 0x%x\n"
"Client-Software API Version:\t 0x%llx\n" "Client-S/w API Version : 0x%llx\n"
"********************************************************\n", "********************************************************\n",
boardrev, boardrev,
ipadd, ipadd,
@ -372,11 +372,12 @@ void setupDetector() {
// Initialization // Initialization
setPhaseShiftOnce(); 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) 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 else
prepareADC9257(); prepareADC9257();
configureADC(); //configureADC();
setROIADC(-1); // set adcsyncreg, daqreg, chipofinterestreg, cleanfifos, setROIADC(-1); // set adcsyncreg, daqreg, chipofinterestreg, cleanfifos,
setGbitReadout(); setGbitReadout();
initDac(0); /*FIXME: if it doesnt work, switch to the old dac*/ initDac(0); /*FIXME: if it doesnt work, switch to the old dac*/

View File

@ -112,7 +112,7 @@ void setAdc9252(int addr, int val) {
} }
void prepareADC9252(){ void prepareADC9252(){
FILE_LOG(logINFOBLUE, ("Preparing ADC:\n")); FILE_LOG(logINFOBLUE, ("Preparing ADC9252:\n"));
//power mode reset //power mode reset
FILE_LOG(logINFO, ("\tPower mode reset\n")); FILE_LOG(logINFO, ("\tPower mode reset\n"));

View File

@ -143,7 +143,7 @@ void setAdc9257(int addr, int val) {
} }
void prepareADC9257(){ void prepareADC9257(){
FILE_LOG(logINFOBLUE, ("Preparing ADC:\n")); FILE_LOG(logINFOBLUE, ("Preparing ADC9257:\n"));
//power mode reset //power mode reset
FILE_LOG(logINFO, ("\tPower mode reset\n")); FILE_LOG(logINFO, ("\tPower mode reset\n"));
@ -192,4 +192,5 @@ void prepareADC9257(){
FILE_LOG(logINFO, ("\tMixed bit frequency test mode\n")); FILE_LOG(logINFO, ("\tMixed bit frequency test mode\n"));
setAdc9257(AD9257_TEST_MODE_REG, AD9257_TST_MXD_BT_FRQ_VAL); setAdc9257(AD9257_TEST_MODE_REG, AD9257_TST_MXD_BT_FRQ_VAL);
#endif #endif
} }

View File

@ -1496,7 +1496,7 @@ int set_timer(int file_des) {
return printSocketReadError(); return printSocketReadError();
enum timerIndex ind = (int)args[0]; enum timerIndex ind = (int)args[0];
int64_t tns = args[1]; int64_t tns = args[1];
char timerName[20] = {0}; char timerName[50] = {0};
strcpy(timerName, getTimerName(ind)); strcpy(timerName, getTimerName(ind));
#ifdef EIGERD #ifdef EIGERD
int64_t subexptime = 0; int64_t subexptime = 0;
@ -1562,15 +1562,16 @@ int set_timer(int file_des) {
} }
// validate // validate
sprintf(timerName, "set %s", timerName); char vtimerName[50] = {0};
sprintf(vtimerName, "set %s", timerName);
#ifdef EIGERD #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 #else
switch(ind) { switch(ind) {
case FRAME_NUMBER: case FRAME_NUMBER:
case CYCLES_NUMBER: case CYCLES_NUMBER:
case STORAGE_CELL_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; break;
case SAMPLES_JCTB: case SAMPLES_JCTB:
if (retval == -1) { if (retval == -1) {
@ -1580,7 +1581,7 @@ int set_timer(int file_des) {
(long long unsigned int)tns); (long long unsigned int)tns);
FILE_LOG(logERROR,(mess)); FILE_LOG(logERROR,(mess));
} else } 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 ACQUISITION_TIME:
case FRAME_PERIOD: case FRAME_PERIOD:
case DELAY_AFTER_TRIGGER: 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) // losing precision due to conversion to clock (also gotthard master delay is different)
if (validateTimer(ind, tns, retval) == FAIL) { if (validateTimer(ind, tns, retval) == FAIL) {
ret = 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); (long long unsigned int)tns, (long long unsigned int)retval);
FILE_LOG(logERROR,(mess)); 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(); functionNotImplemented();
#else #else
// set & get // set & get
@ -1838,8 +1839,7 @@ int set_roi(int file_des) {
if (nretval == -1) // chip test board if (nretval == -1) // chip test board
sprintf(mess,"Could not set ROI. Max ROI level (100) reached!\n"); sprintf(mess,"Could not set ROI. Max ROI level (100) reached!\n");
else if (nretval == -2) else if (nretval == -2)
sprintf(mess, "Could not set ROI. Could not allocate RAM\n", sprintf(mess, "Could not set ROI. Could not allocate RAM\n");
(long long unsigned int)tns);
else else
sprintf(mess,"Could not set all roi. " sprintf(mess,"Could not set all roi. "
"Set %d rois, but read %d rois\n", narg, nretval); "Set %d rois, but read %d rois\n", narg, nretval);