mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
@ -210,6 +210,8 @@
|
||||
|
||||
#define EXT_SIGNAL_OFST (0)
|
||||
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
|
||||
#define EXT_SYNC_OFST (4)
|
||||
#define EXT_SYNC_MSK (0x00000001 << EXT_SYNC_OFST)
|
||||
|
||||
/* Control Register */
|
||||
#define CONTROL_REG (0x4F << MEM_MAP_SHIFT)
|
||||
|
Binary file not shown.
@ -1380,6 +1380,19 @@ int isMaster(int *retval) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getSynchronization() {
|
||||
return ((bus_r(EXT_SIGNAL_REG) & EXT_SYNC_MSK) >> EXT_SYNC_OFST);
|
||||
}
|
||||
|
||||
void setSynchronization(int enable) {
|
||||
LOG(logINFOBLUE,
|
||||
("%s Synchronization\n", (enable ? "Enabling" : "Disabling")));
|
||||
if (enable)
|
||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SYNC_MSK);
|
||||
else
|
||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SYNC_MSK);
|
||||
}
|
||||
|
||||
void setTiming(enum timingMode arg) {
|
||||
switch (arg) {
|
||||
case AUTO_TIMING:
|
||||
|
@ -397,6 +397,11 @@ int isTop(int *retval);
|
||||
int isMaster(int *retval);
|
||||
#endif
|
||||
|
||||
#ifdef JUNGFRAUD
|
||||
int getSynchronization();
|
||||
void setSynchronization(int enable);
|
||||
#endif
|
||||
|
||||
#ifdef GOTTHARD2D
|
||||
void updatingRegisters();
|
||||
#endif
|
||||
|
@ -304,3 +304,5 @@ int set_analog_pulsing(int);
|
||||
int get_digital_pulsing(int);
|
||||
int set_digital_pulsing(int);
|
||||
int get_module(int);
|
||||
int get_synchronization(int);
|
||||
int set_synchronization(int);
|
@ -468,6 +468,8 @@ void function_table() {
|
||||
flist[F_GET_DIGITAL_PULSING] = &get_digital_pulsing;
|
||||
flist[F_SET_DIGITAL_PULSING] = &set_digital_pulsing;
|
||||
flist[F_GET_MODULE] = &get_module;
|
||||
flist[F_GET_SYNCHRONIZATION] = &get_synchronization;
|
||||
flist[F_SET_SYNCHRONIZATION] = &set_synchronization;
|
||||
|
||||
// check
|
||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||
@ -10126,4 +10128,51 @@ int set_digital_pulsing(int file_des) {
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int get_synchronization(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
|
||||
LOG(logDEBUG1, ("Getting synchronization\n"));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
retval = getSynchronization();
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_synchronization(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
LOG(logDEBUG1, ("Setting synchronization: %u\n", (int)arg));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if ((check_detector_idle("set synchronization") == OK) &&
|
||||
(arg != 0 && arg != 1)) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not set synchronization. Invalid argument %d.\n",
|
||||
arg);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
setSynchronization(arg);
|
||||
int retval = getSynchronization();
|
||||
LOG(logDEBUG1, ("synchronization retval: %u\n", retval));
|
||||
validate(&ret, mess, arg, retval, "set synchronization", DEC);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user