jungfrau server fix (3.1.3): delay after trigger set at testbus

This commit is contained in:
maliakal_d 2018-06-28 16:19:19 +02:00
parent 144bd7124b
commit 14d227f8db
4 changed files with 52 additions and 35 deletions

View File

@ -75,8 +75,8 @@
#define TIME_FROM_START_MSB_REG (0x11 << MEM_MAP_SHIFT)
/* Get Delay 64 bit register */
#define GET_DELAY_LSB_REG (0x12 << MEM_MAP_SHIFT)
#define GET_DELAY_MSB_REG (0x13 << MEM_MAP_SHIFT)
#define GET_DELAY_LSB_REG (0x12 << MEM_MAP_SHIFT) // different kind of delay
#define GET_DELAY_MSB_REG (0x13 << MEM_MAP_SHIFT) // different kind of delay
/* Get Cycles 64 bit register */
#define GET_CYCLES_LSB_REG (0x14 << MEM_MAP_SHIFT)
@ -349,8 +349,8 @@
/* Set Delay 64 bit register */
#define SET_DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT)
#define SET_DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT)
#define SET_DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT) // different kind of delay
#define SET_DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT) // different kind of delay
/* Set Cycles 64 bit register */
#define SET_CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT)

View File

@ -213,18 +213,21 @@ int testBus() {
printf("\nTesting Bus...\n");
int ret = OK;
u_int32_t addr = SET_DELAY_LSB_REG;
u_int32_t addr = SET_TRIGGER_DELAY_LSB_REG;
int times = 1000 * 1000;
int i = 0;
for (i = 0; i < times; ++i) {
bus_w(addr, i * 100);
if (i * 100 != bus_r(SET_DELAY_LSB_REG)) {
cprintf(RED,"ERROR: Mismatch! Wrote 0x%x, read 0x%x\n", i * 100, bus_r(SET_DELAY_LSB_REG));
if (i * 100 != bus_r(addr)) {
cprintf(RED,"ERROR: Mismatch! Wrote 0x%x, read 0x%x\n",
i * 100, bus_r(addr));
ret = FAIL;
}
}
bus_w(addr, 0);
if (ret == OK)
printf("Successfully tested bus %d times\n", times);
return ret;
@ -807,12 +810,12 @@ int64_t getTimeLeft(enum timerIndex ind){
retval = get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG) / (1E-3 * CLK_SYNC);
printf("Getting period left: %lldns\n", (long long int)retval);
break;
/*
case DELAY_AFTER_TRIGGER:
retval = get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-3 * CLK_SYNC);
retval = get64BitReg(xxx) / (1E-3 * CLK_SYNC);
printf("Getting delay left: %lldns\n", (long long int)retval);
break;
*/
case CYCLES_NUMBER:
retval = get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
printf("Getting number of cycles left: %lld\n", (long long int)retval);

View File

@ -2904,39 +2904,53 @@ int get_time_left(int file_des) {
printf("getting time left on timer %d \n",ind);
#endif
#ifdef SLS_DETECTOR_FUNCTION_LIST
switch(ind) {
#ifdef JUNGFRAUD
if (ind == DELAY_AFTER_TRIGGER) {
ret = FAIL;
sprintf(mess,"Timer Left Index (%d) is not implemented for this release.\n", (int)ind);
cprintf(RED, "%s", mess);
} else {
#endif
switch(ind) {
#ifdef MYTHEND
case PROBES_NUMBER:
case PROBES_NUMBER:
#elif JUNGFRAUD
case FRAMES_FROM_START:
case FRAMES_FROM_START_PG:
case FRAMES_FROM_START:
case FRAMES_FROM_START_PG:
#elif MYTHEN3D
case GATES_NUMBER:
case PROBES_NUMBER:
case SAMPLES_JCTB:
case GATES_NUMBER:
case PROBES_NUMBER:
case SAMPLES_JCTB:
#endif
#ifndef JUNGFRAUD
case GATES_NUMBER:
case GATES_NUMBER:
#endif
case FRAME_NUMBER:
case ACQUISITION_TIME:
case FRAME_PERIOD:
case DELAY_AFTER_TRIGGER:
case CYCLES_NUMBER:
case PROGRESS:
case ACTUAL_TIME:
case MEASUREMENT_TIME:
retval=getTimeLeft(ind);
break;
default:
ret = FAIL;
sprintf(mess,"Timer Left Index (%d) is not implemented for this detector\n", (int)ind);
cprintf(RED, "%s", mess);
break;
}
case FRAME_NUMBER:
case ACQUISITION_TIME:
case FRAME_PERIOD:
case DELAY_AFTER_TRIGGER:
case CYCLES_NUMBER:
case PROGRESS:
case ACTUAL_TIME:
case MEASUREMENT_TIME:
retval=getTimeLeft(ind);
break;
default:
ret = FAIL;
sprintf(mess,"Timer Left Index (%d) is not implemented for this detector\n", (int)ind);
cprintf(RED, "%s", mess);
break;
}
#ifdef VERBOSE
printf("Time left on timer %d is %lld\n",ind, retval);
printf("Time left on timer %d is %lld\n",ind, retval);
#endif
#ifdef JUNGFRAUD
} // end of if (ind == DELAY_AFTER_TRIGGER)
#endif
#endif
if (ret==OK && differentClients)
ret=FORCE_UPDATE;