This commit is contained in:
2022-11-08 10:25:12 +01:00
parent 16e9b272c7
commit 4a95ee8362
6 changed files with 68 additions and 60 deletions

View File

@ -1050,10 +1050,11 @@ int Feb_Control_StopAcquisition() {
// check stuck only 2000 times (1s)
if (is_processing == STATUS_RUNNING) {
if (check_stuck == 2000) {
LOG(logERROR, ("Unable to get feb processing done signal\n"));
LOG(logERROR,
("Unable to get feb processing done signal\n"));
// at least it is idle
if (Feb_Control_AcquisitionInProgress() == STATUS_IDLE) {
return 1;
return 1;
}
LOG(logERROR, ("Unable to get acquisition done signal\n"));
return 0;
@ -1757,9 +1758,8 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
}
// Inconsistent values when reading both registers
if ((run[0] & run[1]) & (value[0] != value[1])) {
LOG(logERROR,
("Inconsistent values read from %s 0x%x and %s 0x%x\n",
side[0], value[0], side[1], value[1]));
LOG(logERROR, ("Inconsistent values read from %s 0x%x and %s 0x%x\n",
side[0], value[0], side[1], value[1]));
return 0;
}
return 1;

View File

@ -2185,8 +2185,9 @@ int setTrimbits(int *chanregs, char *mess) {
// if quad, set M8 and PROGRAM manually
if (!Feb_Control_SetChipSignalsToTrimQuad(1)) {
sprintf(mess, "Could not set module. Could not enable chip signals to set trimbits\n");
LOG(logERROR, (mess));
sprintf(mess, "Could not set module. Could not enable chip signals to "
"set trimbits\n");
LOG(logERROR, (mess));
sharedMemory_unlockLocalLink();
return FAIL;
}
@ -2200,8 +2201,9 @@ int setTrimbits(int *chanregs, char *mess) {
// if quad, reset M8 and PROGRAM manually
if (!Feb_Control_SetChipSignalsToTrimQuad(0)) {
sprintf(mess, "Could not set module. Could not disable chip signals to set trimbits\n");
LOG(logERROR, (mess));
sprintf(mess, "Could not set module. Could not disable chip "
"signals to set trimbits\n");
LOG(logERROR, (mess));
sharedMemory_unlockLocalLink();
return FAIL;
}
@ -2212,8 +2214,9 @@ int setTrimbits(int *chanregs, char *mess) {
// if quad, reset M8 and PROGRAM manually
if (!Feb_Control_SetChipSignalsToTrimQuad(0)) {
sprintf(mess, "Could not set module. Could not disable chip signals to set trimbits\n");
LOG(logERROR, (mess));
sprintf(mess, "Could not set module. Could not disable chip signals to "
"set trimbits\n");
LOG(logERROR, (mess));
sharedMemory_unlockLocalLink();
return FAIL;
}
@ -2816,8 +2819,9 @@ int stopStateMachine() {
// reset feb and beb
sharedMemory_lockLocalLink();
// uncommenting this out as it randomly does not set the processing bit to high
//Feb_Control_Reset();
// uncommenting this out as it randomly does not set the processing bit to
// high
// Feb_Control_Reset();
sharedMemory_unlockLocalLink();
if (!Beb_StopAcquisition()) {
LOG(logERROR, ("failed to stop acquisition\n"));

View File

@ -1527,7 +1527,11 @@ int write_register(int file_des) {
} else {
if (readRegister(addr, &retval) == FAIL) {
ret = FAIL;
sprintf(mess, "Could not read register 0x%x or inconsistent values. Try to read +0x100 for only left and +0x200 for only right.\n", addr);
sprintf(
mess,
"Could not read register 0x%x or inconsistent values. Try "
"to read +0x100 for only left and +0x200 for only right.\n",
addr);
LOG(logERROR, (mess));
}
}
@ -1565,7 +1569,10 @@ int read_register(int file_des) {
#elif EIGERD
if (readRegister(addr, &retval) == FAIL) {
ret = FAIL;
sprintf(mess, "Could not read register 0x%x or inconsistent values. Try +0x100 for only left and +0x200 for only right..\n", addr);
sprintf(mess,
"Could not read register 0x%x or inconsistent values. Try "
"+0x100 for only left and +0x200 for only right..\n",
addr);
LOG(logERROR, (mess));
}
#else
@ -1896,57 +1903,55 @@ int acquire(int blocking, int file_des) {
#ifdef EIGERD
// check for hardware mac and hardware ip
if (udpDetails[0].srcmac != getDetectorMAC()) {
ret = FAIL;
uint64_t sourcemac = getDetectorMAC();
char src_mac[MAC_ADDRESS_SIZE];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
sprintf(
mess,
ret = FAIL;
uint64_t sourcemac = getDetectorMAC();
char src_mac[MAC_ADDRESS_SIZE];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
sprintf(mess,
"Invalid udp source mac address for this detector. Must be "
"same as hardware detector mac address %s\n",
src_mac);
LOG(logERROR, (mess));
} else if (!enableTenGigabitEthernet(GET_FLAG) &&
(udpDetails[0].srcip != getDetectorIP())) {
ret = FAIL;
uint32_t sourceip = getDetectorIP();
char src_ip[INET_ADDRSTRLEN];
getIpAddressinString(src_ip, sourceip);
sprintf(
mess,
LOG(logERROR, (mess));
} else if (!enableTenGigabitEthernet(GET_FLAG) &&
(udpDetails[0].srcip != getDetectorIP())) {
ret = FAIL;
uint32_t sourceip = getDetectorIP();
char src_ip[INET_ADDRSTRLEN];
getIpAddressinString(src_ip, sourceip);
sprintf(mess,
"Invalid udp source ip address for this detector. Must be "
"same as hardware detector ip address %s in 1G readout "
"mode \n",
src_ip);
LOG(logERROR, (mess));
} else
LOG(logERROR, (mess));
} else
#endif
if (configured == FAIL) {
if (configured == FAIL) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because ");
strcat(mess, configureMessage);
LOG(logERROR, (mess));
} else if (sharedMemory_getScanStatus() == RUNNING) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because a scan is "
"already running!\n");
LOG(logERROR, (mess));
} else {
memset(scanErrMessage, 0, MAX_STR_LENGTH);
sharedMemory_setScanStop(0);
sharedMemory_setScanStatus(IDLE); // if it was error
if (pthread_create(&pthread_tid, NULL, &start_state_machine,
&blocking)) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because ");
strcat(mess, configureMessage);
LOG(logERROR, (mess));
} else if (sharedMemory_getScanStatus() == RUNNING) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because a scan is "
"already running!\n");
strcpy(mess, "Could not start acquisition thread!\n");
LOG(logERROR, (mess));
} else {
memset(scanErrMessage, 0, MAX_STR_LENGTH);
sharedMemory_setScanStop(0);
sharedMemory_setScanStatus(IDLE); // if it was error
if (pthread_create(&pthread_tid, NULL, &start_state_machine,
&blocking)) {
ret = FAIL;
strcpy(mess, "Could not start acquisition thread!\n");
LOG(logERROR, (mess));
} else {
// only does not wait for non blocking and scan
if (blocking || !scan) {
pthread_join(pthread_tid, NULL);
}
// only does not wait for non blocking and scan
if (blocking || !scan) {
pthread_join(pthread_tid, NULL);
}
}
}
}
return Server_SendResult(file_des, INT32, NULL, 0);
}