Merge branch 'vetoheader' of github.com:slsdetectorgroup/slsDetectorPackage into vetoheader

This commit is contained in:
Erik Frojdh 2020-05-28 11:33:59 +02:00
commit e884836f5c
5 changed files with 32 additions and 36 deletions

View File

@ -250,6 +250,6 @@
/* UDP datagram registers --------------------------------------------------*/
#define RXR_ENDPOINTS_MAX (32)
#define RXR_ENDPOINT_OFST (0x10)
#define RXR_ENDPOINT_OFST (16 * REG_OFFSET)
// clang-format on

View File

@ -1420,7 +1420,10 @@ int configureMAC() {
getIpAddressinString(dst_ip2, dstip2);
int numInterfaces = getNumberofUDPInterfaces();
LOG(logINFO, ("\t#Interfaces : %d\n", numInterfaces));
int vetoEnabled = getVeto();
LOG(logINFO, ("\t#Veto : %d\n", vetoEnabled));
LOG(logINFO, ("\t#10Gb Interfaces : %d\n", numInterfaces));
LOG(logINFO, ("\tData Interface \n"));
LOG(logINFO, ("\tSource IP : %s\n"
@ -1431,8 +1434,9 @@ int configureMAC() {
"\tDest Port : %d\n",
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
LOG(logINFO, ("\tVeto Interface (%s)\n",
(numInterfaces == 2 ? "enabled" : "disabled")));
LOG(logINFO,
("\tVeto Interface (%s)\n",
(vetoEnabled && numInterfaces == 2 ? "enabled" : "disabled")));
LOG(logINFO, ("\tSource IP2 : %s\n"
"\tSource MAC2 : %s\n"
"\tSource Port2: %d\n"
@ -1446,7 +1450,7 @@ int configureMAC() {
LOG(logERROR, ("could not set udp destination IP and port\n"));
return FAIL;
}
if (numInterfaces == 2 &&
if (vetoEnabled && numInterfaces == 2 &&
setUDPDestinationDetails(1, dst_ip2, dstport2) == FAIL) {
LOG(logERROR,
("could not set udp destination IP and port for interface 2\n"));
@ -1461,7 +1465,7 @@ int configureMAC() {
setupHeader(iRxEntry, 0, dstip, dstmac, dstport, srcmac, srcip, srcport);
// veto
if (numInterfaces == 2) {
if (vetoEnabled && numInterfaces == 2) {
setupHeader(iRxEntry, 1, dstip2, dstmac2, dstport2, srcmac2, srcip2,
srcport2);
}
@ -2234,7 +2238,8 @@ int startStateMachine() {
if (createUDPSocket(0) != OK) {
return FAIL;
}
if (getNumberofUDPInterfaces() == 2 && createUDPSocket(1) != OK) {
if (getVeto() && getNumberofUDPInterfaces() == 2 &&
createUDPSocket(1) != OK) {
return FAIL;
}
LOG(logINFOBLUE, ("Starting State Machine\n"));
@ -2277,6 +2282,8 @@ void *start_timer(void *arg) {
}
int numInterfaces = getNumberofUDPInterfaces();
int vetoEnabled = getVeto();
int numRepeats = getNumTriggers();
if (getTiming() == AUTO_TIMING) {
if (burstMode == BURST_OFF) {
@ -2352,7 +2359,7 @@ void *start_timer(void *arg) {
// second interface (veto)
char packetData2[vetopacketsize];
memset(packetData2, 0, vetopacketsize);
if (numInterfaces == 2) {
if (vetoEnabled && numInterfaces == 2) {
// set header
veto_header *header = (veto_header *)(packetData2);
header->frameNumber = frameHeaderNr;
@ -2393,7 +2400,7 @@ void *start_timer(void *arg) {
}
closeUDPSocket(0);
if (numInterfaces == 2) {
if (vetoEnabled && numInterfaces == 2) {
closeUDPSocket(1);
}

View File

@ -7454,36 +7454,25 @@ int set_veto(int file_des) {
#else
// only set
if (Server_VerifyLock() == OK) {
// veto allowed only if module attached or in -nomodule mode
if (arg > 0) {
if (checkModuleFlag) {
int type_ret = checkDetectorType();
if (type_ret == -1) {
ret = FAIL;
sprintf(mess, "Could not enable veto streaming. "
"Could not open "
"file to know if module attached.\n");
setVeto(arg);
// if numinterfaces is 2 and veto is 1 now, then configuremac
if (arg > 0 && getNumberofUDPInterfaces() == 2 &&
is_configurable() == OK) {
ret = configureMAC();
if (ret != OK) {
sprintf(mess, "Configure Mac failed after enabling veto\n");
strcpy(configureMessage, mess);
LOG(logERROR, (mess));
} else if (type_ret == -2) {
ret = FAIL;
sprintf(mess, "Could not enable veto streaming. No "
"module attached!\n");
LOG(logERROR, (mess));
} else if (type_ret == FAIL) {
ret = FAIL;
sprintf(mess, "Could not enable veto streaming. Wrong "
"module type "
"attached!\n");
LOG(logERROR, (mess));
}
configured = FAIL;
LOG(logWARNING, ("Configure FAIL, not all parameters "
"configured yet\n"));
} else {
LOG(logINFOBLUE,
("In No-Module mode: Ignoring module-attached check. "
"Continuing to enable veto streaming.\n"));
LOG(logINFOGREEN, ("\tConfigure MAC successful\n"));
configured = OK;
}
}
if (ret == OK) {
setVeto(arg);
int retval = getVeto();
LOG(logDEBUG1, ("veto mode retval: %u\n", retval));
validate(arg, retval, "set veto mode", DEC);

View File

@ -9,4 +9,4 @@
#define APIMOENCH 0x200515
#define APIEIGER 0x200520
#define APIMYTHEN3 0x200526
#define APIGOTTHARD2 0x200527
#define APIGOTTHARD2 0x200528