conflict merge fix

This commit is contained in:
2021-07-22 11:53:00 +02:00
23 changed files with 371 additions and 78 deletions

View File

@ -90,8 +90,14 @@
#define CONFIG_VETO_ENBL_OFST (0)
#define CONFIG_VETO_ENBL_MSK (0x00000001 << CONFIG_VETO_ENBL_OFST)
#define CONFIG_VETO_CH_3GB_ALG_OFST (8)
#define CONFIG_VETO_CH_3GB_ALG_MSK (0x00000007 << CONFIG_VETO_CH_3GB_ALG_OFST)
#define CONFIG_VETO_CH_3GB_ALG_DEFAULT_VAL ((0x0 << CONFIG_VETO_CH_3GB_ALG_OFST) & CONFIG_VETO_CH_3GB_ALG_MSK)
#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_ALG_OFST (12)
#define CONFIG_VETO_CH_10GB_ALG_MSK (0x00000007 << CONFIG_VETO_CH_10GB_ALG_OFST)
#define CONFIG_VETO_CH_10GB_ALG_DEFAULT_VAL ((0x0 << CONFIG_VETO_CH_10GB_ALG_OFST) & CONFIG_VETO_CH_10GB_ALG_MSK)
#define CONFIG_VETO_CH_10GB_ENBL_OFST (15)
#define CONFIG_VETO_CH_10GB_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_10GB_ENBL_OFST)

View File

@ -2595,6 +2595,36 @@ int getVetoStream() {
return ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_3GB_ENBL_MSK) ? 1 : 0);
}
enum vetoAlgorithm getVetoAlgorithm(enum ethernetInterface interface) {
// 3gbe
if (interface == I3GBE) {
int retval = ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_3GB_ALG_MSK) >>
CONFIG_VETO_CH_3GB_ALG_OFST);
switch (retval) {
// more to follow
case CONFIG_VETO_CH_3GB_ALG_DEFAULT_VAL:
return DEFAULT_ALGORITHM;
default:
LOG(logERROR, ("unknown algorithm %d for 3gbe\n", retval));
return -1;
}
}
// 10gbe
int retval = ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_10GB_ALG_MSK) >>
CONFIG_VETO_CH_10GB_ALG_OFST);
switch (retval) {
// more to follow
case CONFIG_VETO_CH_10GB_ALG_DEFAULT_VAL:
return DEFAULT_ALGORITHM;
default:
LOG(logERROR, ("unknown algorithm %d for 3gbe\n", retval));
return -1;
}
}
void setVetoAlgorithm(enum ethernetInterface interface,
enum vetoAlgorithm alg) {}
void setBadChannels(int nch, int *channels) {
LOG(logINFO, ("Setting %d bad channels\n", nch));

View File

@ -532,6 +532,8 @@ void setVeto(int enable);
int getVeto();
void setVetoStream(int value);
int getVetoStream();
enum vetoAlgorithm getVetoAlgorithm(enum ethernetInterface interface);
void setVetoAlgorithm(enum ethernetInterface interface, enum vetoAlgorithm alg);
void setBadChannels(int nch, int *channels);
int *getBadChannels(int *nch);
#endif

View File

@ -251,3 +251,5 @@ int get_datastream(int);
int set_datastream(int);
int get_veto_stream(int);
int set_veto_stream(int);
int get_veto_algorithm(int);
int set_veto_algorithm(int);

View File

@ -377,6 +377,8 @@ void function_table() {
flist[F_SET_DATASTREAM] = &set_datastream;
flist[F_GET_VETO_STREAM] = &get_veto_stream;
flist[F_SET_VETO_STREAM] = &set_veto_stream;
flist[F_GET_VETO_ALGORITHM] = &get_veto_algorithm;
flist[F_SET_VETO_ALGORITHM] = &set_veto_algorithm;
// check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
@ -8319,7 +8321,7 @@ int set_datastream(int file_des) {
int get_veto_stream(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
enum EthernetInterface retval = NONE;
enum ethernetInterface retval = NONE;
LOG(logDEBUG1, ("Getting veto stream\n"));
@ -8336,7 +8338,7 @@ int get_veto_stream(int file_des) {
int set_veto_stream(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
enum EthernetInterface arg = 0;
enum ethernetInterface arg = 0;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
@ -8363,4 +8365,71 @@ int set_veto_stream(int file_des) {
}
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_veto_algorithm(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
enum ethernetInterface arg = NONE;
enum vetoAlgorithm retval = DEFAULT_ALGORITHM;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
LOG(logDEBUG1, ("Getting veto algorithm for interface %d\n", arg));
#ifndef GOTTHARD2D
functionNotImplemented();
#else
// get only
if (arg != I3GBE && arg != I10GBE) {
ret = FAIL;
sprintf(mess, "Could not get vetoalgorithm. Invalid interface %d.\n",
arg);
LOG(logERROR, (mess));
} else {
retval = getVetoAlgorithm(arg);
LOG(logDEBUG1, ("vetoalgorithm retval: %u\n", retval));
}
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
int set_veto_algorithm(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int args[2] = {-1, -1};
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
return printSocketReadError();
enum vetoAlgorithm alg = args[0];
enum ethernetInterface interface = args[1];
LOG(logINFO, ("Setting vetoalgorithm (interface: %d): %u\n", (int)interface,
(int)alg));
#ifndef GOTTHARD2D
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
if (interface != I3GBE && interface != I10GBE) {
ret = FAIL;
sprintf(mess,
"Could not set vetoalgorithm. Invalid interface %d.\n",
interface);
LOG(logERROR, (mess));
} else if (alg != DEFAULT_ALGORITHM) {
ret = FAIL;
sprintf(mess,
"Could not set vetoalgorithm. Invalid algorithm %d.\n",
alg);
LOG(logERROR, (mess));
} else {
setVetoAlgorithm(alg, interface);
int retval = getVetoAlgorithm(interface);
LOG(logDEBUG1, ("vetoalgorithm retval: %u\n", retval));
validate(&ret, mess, alg, retval, "set veto algorithm", DEC);
}
}
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}