mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 14:38:14 +02:00
fix
This commit is contained in:
parent
0fb6c8b823
commit
0d521b64b6
@ -754,6 +754,7 @@ int setDynamicRange(int dr) {
|
|||||||
bus_w(CONFIG_REG, bus_r(CONFIG_REG) & ~CONFIG_DYNAMIC_RANGE_MSK);
|
bus_w(CONFIG_REG, bus_r(CONFIG_REG) & ~CONFIG_DYNAMIC_RANGE_MSK);
|
||||||
bus_w(CONFIG_REG, bus_r(CONFIG_REG) | regval);
|
bus_w(CONFIG_REG, bus_r(CONFIG_REG) | regval);
|
||||||
updatePacketizing();
|
updatePacketizing();
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getDynamicRange(int *retval) {
|
int getDynamicRange(int *retval) {
|
||||||
|
@ -4657,26 +4657,25 @@ int set_read_n_rows(int file_des) {
|
|||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
int dr = 0;
|
int dr = 0;
|
||||||
ret = getDynamicRange(&dr);
|
ret = getDynamicRange(&dr);
|
||||||
|
int isTenGiga = enableTenGigabitEthernet(GET_FLAG);
|
||||||
|
unsigned int maxnl = MAX_ROWS_PER_READOUT;
|
||||||
|
unsigned int maxnp = (isTenGiga ? 4 : 16) * dr;
|
||||||
|
// get dr fail
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
strcpy(mess,
|
strcpy(mess,
|
||||||
"Could not read n rows (failed to get dynamic range)\n");
|
"Could not read n rows (failed to get dynamic range)\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else if ((arg * maxnp) % maxnl) {
|
||||||
int isTenGiga = enableTenGigabitEthernet(GET_FLAG);
|
ret = FAIL;
|
||||||
unsigned int maxnl = MAX_ROWS_PER_READOUT;
|
sprintf(mess,
|
||||||
unsigned int maxnp = (isTenGiga ? 4 : 16) * dr;
|
|
||||||
if ((arg * maxnp) % maxnl) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(
|
|
||||||
mess,
|
|
||||||
"Could not set number of rows to %d. For %d bit "
|
"Could not set number of rows to %d. For %d bit "
|
||||||
"mode and 10 giga %s, (%d (num "
|
"mode and 10 giga %s, (%d (num "
|
||||||
"rows) x %d (max num packets for this mode)) must be "
|
"rows) x %d (max num packets for this mode)) must be "
|
||||||
"divisible by %d\n",
|
"divisible by %d\n",
|
||||||
arg, dr, isTenGiga ? "enabled" : "disabled", arg, maxnp,
|
arg, dr, isTenGiga ? "enabled" : "disabled", arg, maxnp,
|
||||||
maxnl);
|
maxnl);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else
|
} else
|
||||||
#elif JUNGFRAUD
|
#elif JUNGFRAUD
|
||||||
if ((check_detector_idle("set number of rows") == OK) &&
|
if ((check_detector_idle("set number of rows") == OK) &&
|
||||||
(arg % READ_N_ROWS_MULTIPLE != 0)) {
|
(arg % READ_N_ROWS_MULTIPLE != 0)) {
|
||||||
@ -4695,22 +4694,20 @@ int set_read_n_rows(int file_des) {
|
|||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (setReadNRows(arg) == FAIL) {
|
if (setReadNRows(arg) == FAIL) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess, "Could not set number of rows to %d.\n", arg);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
int retval = getReadNRows();
|
||||||
|
if (arg != retval) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Could not set number of rows to %d.\n",
|
sprintf(mess,
|
||||||
arg);
|
"Could not set number of rows. Set %d, but "
|
||||||
|
"read %d\n",
|
||||||
|
retval, arg);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
|
||||||
int retval = getReadNRows();
|
|
||||||
if (arg != retval) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess,
|
|
||||||
"Could not set number of rows. Set %d, but "
|
|
||||||
"read %d\n",
|
|
||||||
retval, arg);
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user