mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
jf: timing info decoder (#987)
* timing_info_decoder command with options swissfel (default) and shine. added to python, command line generation, autocomplete, tostring, tests.
This commit is contained in:
@ -607,6 +607,8 @@ uint64_t getSelectCurrentSource();
|
||||
int getPedestalMode();
|
||||
void getPedestalParameters(uint8_t *frames, uint16_t *loops);
|
||||
void setPedestalMode(int enable, uint8_t frames, uint16_t loops);
|
||||
int setTimingInfoDecoder(enum timingInfoDecoder val);
|
||||
int getTimingInfoDecoder(enum timingInfoDecoder *retval);
|
||||
int getElectronCollectionMode();
|
||||
void setElectronCollectionMode(int enable);
|
||||
#endif
|
||||
|
@ -330,5 +330,7 @@ int setColumn(int);
|
||||
int get_pedestal_mode(int);
|
||||
int set_pedestal_mode(int);
|
||||
int config_transceiver(int);
|
||||
int get_timing_info_decoder(int);
|
||||
int set_timing_info_decoder(int);
|
||||
int get_collection_mode(int);
|
||||
int set_collection_mode(int);
|
||||
|
@ -492,6 +492,8 @@ void function_table() {
|
||||
flist[F_GET_PEDESTAL_MODE] = &get_pedestal_mode;
|
||||
flist[F_SET_PEDESTAL_MODE] = &set_pedestal_mode;
|
||||
flist[F_CONFIG_TRANSCEIVER] = &config_transceiver;
|
||||
flist[F_GET_TIMING_INFO_DECODER] = &get_timing_info_decoder;
|
||||
flist[F_SET_TIMING_INFO_DECODER] = &set_timing_info_decoder;
|
||||
flist[F_GET_COLLECTION_MODE] = &get_collection_mode;
|
||||
flist[F_SET_COLLECTION_MODE] = &set_collection_mode;
|
||||
|
||||
@ -11092,6 +11094,73 @@ int config_transceiver(int file_des) {
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
||||
int get_timing_info_decoder(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
enum timingInfoDecoder retval = SWISSFEL;
|
||||
|
||||
LOG(logDEBUG1, ("Getting timing info decoder\n"));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
ret = getTimingInfoDecoder(&retval);
|
||||
LOG(logDEBUG1, ("retval timing info decoder: %d\n", retval));
|
||||
if (ret == FAIL) {
|
||||
strcpy(mess, "Could not get timing info decoder\n");
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_timing_info_decoder(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
enum timingInfoDecoder arg = SWISSFEL;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
LOG(logDEBUG1, ("Setting timing info decoder: %u\n", (int)arg));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
switch (arg) {
|
||||
case SWISSFEL:
|
||||
case SHINE:
|
||||
break;
|
||||
default:
|
||||
modeNotImplemented("Timing info decoder index", (int)arg);
|
||||
break;
|
||||
}
|
||||
if (ret == OK) {
|
||||
ret = setTimingInfoDecoder(arg);
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set timing info decoder\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
enum timingInfoDecoder retval = SWISSFEL;
|
||||
ret = getTimingInfoDecoder(&retval);
|
||||
if (ret == FAIL) {
|
||||
strcpy(mess, "Could not get timing info decoder\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
LOG(logDEBUG1,
|
||||
("timing info decoder retval: %u\n", retval));
|
||||
validate(&ret, mess, (int)arg, (int)retval,
|
||||
"set timing info decoder", DEC);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
||||
int get_collection_mode(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
@ -11123,30 +11192,23 @@ int set_collection_mode(int file_des) {
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (getChipVersion() == 11) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Cannot set addl. number of storage cells for chip v1.1\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
switch (arg) {
|
||||
case HOLE:
|
||||
setElectronCollectionMode(0);
|
||||
break;
|
||||
case ELECTRON:
|
||||
setElectronCollectionMode(1);
|
||||
break;
|
||||
default:
|
||||
modeNotImplemented("Collection mode index", (int)arg);
|
||||
break;
|
||||
}
|
||||
enum collectionMode retval =
|
||||
getElectronCollectionMode() ? ELECTRON : HOLE;
|
||||
validate(&ret, mess, (int)arg, (int)retval, "set collection mode",
|
||||
DEC);
|
||||
LOG(logDEBUG1, ("collection mode retval: %u\n", retval));
|
||||
switch (arg) {
|
||||
case HOLE:
|
||||
setElectronCollectionMode(0);
|
||||
break;
|
||||
case ELECTRON:
|
||||
setElectronCollectionMode(1);
|
||||
break;
|
||||
default:
|
||||
modeNotImplemented("Collection mode index", (int)arg);
|
||||
break;
|
||||
}
|
||||
enum collectionMode retval =
|
||||
getElectronCollectionMode() ? ELECTRON : HOLE;
|
||||
validate(&ret, mess, (int)arg, (int)retval, "set collection mode",
|
||||
DEC);
|
||||
LOG(logDEBUG1, ("collection mode retval: %u\n", retval));
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user