formatting

This commit is contained in:
maliakal_d 2024-02-07 13:25:11 +01:00
parent 56abf82d92
commit 64d489f1e6
3 changed files with 98 additions and 90 deletions

View File

@ -1991,98 +1991,105 @@ int acquire(int blocking, int file_des) {
#if defined(JUNGFRAUD) #if defined(JUNGFRAUD)
// chipv1.1 has to be configured before acquisition // chipv1.1 has to be configured before acquisition
if (getChipVersion() == 11 && !isChipConfigured()) { if (getChipVersion() == 11 && !isChipConfigured()) {
ret = FAIL; ret = FAIL;
strcpy(mess, "Could not start acquisition. Chip is not configured. " strcpy(mess,
"Power it on to configure it.\n"); "Could not start acquisition. Chip is not configured. "
LOG(logERROR, (mess)); "Power it on to configure it.\n");
} else LOG(logERROR, (mess));
} else
#endif #endif
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD) #if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
if ((getReadoutMode() == ANALOG_AND_DIGITAL || if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
getReadoutMode() == ANALOG_ONLY) && getReadoutMode() == ANALOG_ONLY) &&
(getNumAnalogSamples() <= 0)) { (getNumAnalogSamples() <= 0)) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
"Could not start acquisition. Invalid number of analog " "Could not start acquisition. Invalid number of analog "
"samples: %d.\n", "samples: %d.\n",
getNumAnalogSamples()); getNumAnalogSamples());
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else if ((getReadoutMode() == ANALOG_AND_DIGITAL || } else if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
getReadoutMode() == DIGITAL_ONLY || getReadoutMode() == DIGITAL_ONLY ||
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) && getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
(getNumDigitalSamples() <= 0)) { (getNumDigitalSamples() <= 0)) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(
mess,
"Could not start acquisition. Invalid number of digital " "Could not start acquisition. Invalid number of digital "
"samples: %d.\n", "samples: %d.\n",
getNumDigitalSamples()); getNumDigitalSamples());
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else if ((getReadoutMode() == TRANSCEIVER_ONLY || } else if ((getReadoutMode() == TRANSCEIVER_ONLY ||
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) && getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
(getNumTransceiverSamples() <= 0)) { (getNumTransceiverSamples() <= 0)) {
ret = FAIL; ret = FAIL;
sprintf( sprintf(mess,
mess, "Could not start acquisition. Invalid number of "
"Could not start acquisition. Invalid number of transceiver " "transceiver "
"samples: %d.\n", "samples: %d.\n",
getNumTransceiverSamples()); getNumTransceiverSamples());
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else } else
#endif #endif
#ifdef EIGERD #ifdef EIGERD
// check for hardware mac and hardware ip // check for hardware mac and hardware ip
if (udpDetails[0].srcmac != getDetectorMAC()) { if (udpDetails[0].srcmac != getDetectorMAC()) {
ret = FAIL; ret = FAIL;
uint64_t sourcemac = getDetectorMAC(); uint64_t sourcemac = getDetectorMAC();
char src_mac[MAC_ADDRESS_SIZE]; char src_mac[MAC_ADDRESS_SIZE];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac); getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
sprintf(mess, sprintf(mess,
"Invalid udp source mac address for this detector. Must be " "Invalid udp source mac address for this detector. "
"same as hardware detector mac address %s\n", "Must be "
src_mac); "same as hardware detector mac address %s\n",
LOG(logERROR, (mess)); src_mac);
} else if (!enableTenGigabitEthernet(GET_FLAG) && LOG(logERROR, (mess));
(udpDetails[0].srcip != getDetectorIP())) { } else if (!enableTenGigabitEthernet(GET_FLAG) &&
ret = FAIL; (udpDetails[0].srcip != getDetectorIP())) {
uint32_t sourceip = getDetectorIP(); ret = FAIL;
char src_ip[INET_ADDRSTRLEN]; uint32_t sourceip = getDetectorIP();
getIpAddressinString(src_ip, sourceip); char src_ip[INET_ADDRSTRLEN];
sprintf(mess, getIpAddressinString(src_ip, sourceip);
"Invalid udp source ip address for this detector. Must be " sprintf(
"same as hardware detector ip address %s in 1G readout " mess,
"mode \n", "Invalid udp source ip address for this detector. Must "
src_ip); "be "
LOG(logERROR, (mess)); "same as hardware detector ip address %s in 1G readout "
} else "mode \n",
src_ip);
LOG(logERROR, (mess));
} else
#endif #endif
if (configured == FAIL) { if (configured == FAIL) {
ret = FAIL; ret = FAIL;
strcpy(mess, "Could not start acquisition because "); strcpy(mess, "Could not start acquisition because ");
strcat(mess, configureMessage); strcat(mess, configureMessage);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else if (sharedMemory_getScanStatus() == RUNNING) { } else if (sharedMemory_getScanStatus() == RUNNING) {
ret = FAIL; ret = FAIL;
strcpy(mess, "Could not start acquisition because a scan is " strcpy(mess,
"already running!\n"); "Could not start acquisition because a scan is "
LOG(logERROR, (mess)); "already running!\n");
} else { LOG(logERROR, (mess));
memset(scanErrMessage, 0, MAX_STR_LENGTH); } else {
sharedMemory_setScanStop(0); memset(scanErrMessage, 0, MAX_STR_LENGTH);
sharedMemory_setScanStatus(IDLE); // if it was error sharedMemory_setScanStop(0);
if (pthread_create(&pthread_tid, NULL, &start_state_machine, sharedMemory_setScanStatus(IDLE); // if it was error
&blocking)) { if (pthread_create(&pthread_tid, NULL, &start_state_machine,
ret = FAIL; &blocking)) {
strcpy(mess, "Could not start acquisition thread!\n"); ret = FAIL;
LOG(logERROR, (mess)); strcpy(mess, "Could not start acquisition thread!\n");
} else { LOG(logERROR, (mess));
// wait for blocking always (scan or not) } else {
// non blocking-no scan also wait (for error message) // wait for blocking always (scan or not)
// non blcoking-scan dont wait (there is scanErrorMessage) // non blocking-no scan also wait (for error message)
if (blocking || !scan) { // non blcoking-scan dont wait (there is
pthread_join(pthread_tid, NULL); // scanErrorMessage)
if (blocking || !scan) {
pthread_join(pthread_tid, NULL);
}
}
} }
}
}
} }
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);
} }

View File

@ -511,7 +511,8 @@ int waitTransceiverAligned(char *mess) {
// no module: transceiver will never get aligned // no module: transceiver will never get aligned
if (!checkModuleFlag) { if (!checkModuleFlag) {
LOG(logWARNING, ("No module: Transceiver will never get aligned. Ignoring alignment check.\n")); LOG(logWARNING, ("No module: Transceiver will never get aligned. "
"Ignoring alignment check.\n"));
return OK; return OK;
} }

View File

@ -4,11 +4,11 @@
#define RELEASE "developer" #define RELEASE "developer"
#define APILIB "developer 0x230224" #define APILIB "developer 0x230224"
#define APIRECEIVER "developer 0x230224" #define APIRECEIVER "developer 0x230224"
#define APICTB "developer 0x240207" #define APICTB "developer 0x240207"
#define APIGOTTHARD "developer 0x240207" #define APIGOTTHARD "developer 0x240207"
#define APIGOTTHARD2 "developer 0x240207" #define APIGOTTHARD2 "developer 0x240207"
#define APIJUNGFRAU "developer 0x240207" #define APIJUNGFRAU "developer 0x240207"
#define APIMYTHEN3 "developer 0x240207" #define APIMYTHEN3 "developer 0x240207"
#define APIMOENCH "developer 0x240207" #define APIMOENCH "developer 0x240207"
#define APIXILINXCTB "developer 0x240207" #define APIXILINXCTB "developer 0x240207"
#define APIEIGER "developer 0x240207" #define APIEIGER "developer 0x240207"