mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
gotthard2: vetostream (detector: only 3gbe, 10gbe via numudpinterfaces)
This commit is contained in:
@ -90,7 +90,9 @@
|
||||
|
||||
#define CONFIG_VETO_ENBL_OFST (0)
|
||||
#define CONFIG_VETO_ENBL_MSK (0x00000001 << CONFIG_VETO_ENBL_OFST)
|
||||
#define CONFIG_VETO_CH_10GB_ENBL_OFST (1)
|
||||
#define CONFIG_VETO_CH_3GB_ENBL_OFST (11)
|
||||
#define CONFIG_VETO_CH_3GB_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_3GB_ENBL_OFST)
|
||||
#define CONFIG_VETO_CH_10GB_ENBL_OFST (15)
|
||||
#define CONFIG_VETO_CH_10GB_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_10GB_ENBL_OFST)
|
||||
|
||||
/* Control RW register */
|
||||
|
@ -1581,14 +1581,14 @@ enum timingMode getTiming() {
|
||||
void setNumberofUDPInterfaces(int val) {
|
||||
uint32_t addr = CONFIG_REG;
|
||||
|
||||
// 2 interfaces (enable veto)
|
||||
// 2 rxr interfaces (enable debugging interface)
|
||||
if (val > 1) {
|
||||
LOG(logINFOBLUE, ("Setting #Interfaces: 2 (10gbps veto streaming)\n"));
|
||||
LOG(logINFOBLUE, ("Enabling 10GbE (debugging) veto streaming\n"));
|
||||
bus_w(addr, bus_r(addr) | CONFIG_VETO_CH_10GB_ENBL_MSK);
|
||||
}
|
||||
// 1 interface (disable veto)
|
||||
// 1 rxr interface (disable debugging interface)
|
||||
else {
|
||||
LOG(logINFOBLUE, ("Setting #Interfaces: 1 (2.5gbps veto streaming)\n"));
|
||||
LOG(logINFOBLUE, ("Disabling 10GbE (debugging) veto streaming\n"));
|
||||
bus_w(addr, bus_r(addr) & ~CONFIG_VETO_CH_10GB_ENBL_MSK);
|
||||
}
|
||||
LOG(logDEBUG, ("config reg:0x%x\n", bus_r(addr)));
|
||||
@ -2578,6 +2578,23 @@ int getVeto() {
|
||||
CONFIG_VETO_ENBL_OFST);
|
||||
}
|
||||
|
||||
void setVetoStream(int value) {
|
||||
uint32_t addr = CONFIG_REG;
|
||||
|
||||
if (value) {
|
||||
LOG(logINFOBLUE, ("Enabling 3GbE veto streaming\n"));
|
||||
bus_w(addr, bus_r(addr) | CONFIG_VETO_CH_3GB_ENBL_MSK);
|
||||
} else {
|
||||
LOG(logINFOBLUE, ("Disabling 3GbE veto streaming\n"));
|
||||
bus_w(addr, bus_r(addr) & ~CONFIG_VETO_CH_3GB_ENBL_MSK);
|
||||
}
|
||||
LOG(logDEBUG, ("config reg:0x%x\n", bus_r(addr)));
|
||||
}
|
||||
|
||||
int getVetoStream() {
|
||||
return ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_3GB_ENBL_MSK) ? 1 : 0);
|
||||
}
|
||||
|
||||
void setBadChannels(int nch, int *channels) {
|
||||
LOG(logINFO, ("Setting %d bad channels\n", nch));
|
||||
|
||||
|
@ -540,6 +540,8 @@ void setTimingSource(enum timingSourceType value);
|
||||
enum timingSourceType getTimingSource();
|
||||
void setVeto(int enable);
|
||||
int getVeto();
|
||||
void setVetoStream(int value);
|
||||
int getVetoStream();
|
||||
void setBadChannels(int nch, int *channels);
|
||||
int *getBadChannels(int *nch);
|
||||
#endif
|
||||
|
@ -246,4 +246,6 @@ int is_virtual(int);
|
||||
int get_pattern(int);
|
||||
int load_default_pattern(int);
|
||||
int get_all_threshold_energy(int);
|
||||
int get_master(int);
|
||||
int get_master(int);
|
||||
int get_veto_stream(int);
|
||||
int set_veto_stream(int);
|
@ -369,6 +369,8 @@ void function_table() {
|
||||
flist[F_LOAD_DEFAULT_PATTERN] = &load_default_pattern;
|
||||
flist[F_GET_ALL_THRESHOLD_ENERGY] = &get_all_threshold_energy;
|
||||
flist[F_GET_MASTER] = &get_master;
|
||||
flist[F_GET_VETO_STREAM] = &get_veto_stream;
|
||||
flist[F_SET_VETO_STREAM] = &set_veto_stream;
|
||||
|
||||
// check
|
||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||
@ -8406,3 +8408,52 @@ int get_master(int file_des){
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_veto_stream(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
enum EthernetInterface retval = NONE;
|
||||
|
||||
LOG(logDEBUG1, ("Getting veto stream\n"));
|
||||
|
||||
#ifndef GOTTHARD2D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getVetoStream();
|
||||
LOG(logDEBUG1, ("vetostream retval: %u\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_veto_stream(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
enum EthernetInterface arg = 0;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
LOG(logINFO, ("Setting vetostream: %u\n", (int)arg));
|
||||
|
||||
#ifndef GOTTHARD2D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
|
||||
if (arg != 0 && arg != 1) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not set vetostream 3GbE. Invalid argument %d.\n",
|
||||
arg);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
setVetoStream(arg);
|
||||
int retval = getVetoStream();
|
||||
LOG(logDEBUG1, ("vetostream retval: %u\n", retval));
|
||||
validate(arg, retval, "set veto stream", DEC);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
Reference in New Issue
Block a user