mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 21:37:13 +02:00
program fpga printouts for errors
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorPackage/slsDetectorServers/jungfrauDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: ed9dc3b386898603d74a489528292139d47aac1a
|
||||
Revision: 32
|
||||
Repsitory UUID: 969551ae373167dcfc28466f19e53a349da70f67
|
||||
Revision: 33
|
||||
Branch: program
|
||||
Last Changed Author: Erik_Frojdh
|
||||
Last Changed Rev: 4488
|
||||
Last Changed Date: 2019-03-29 14:42:42.000000002 +0100 ../slsDetectorServer/slsDetectorServer_funcs.c
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4489
|
||||
Last Changed Date: 2019-04-01 09:39:27.000000002 +0200 ../slsDetectorServer/slsDetectorServer_funcs.c
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "ed9dc3b386898603d74a489528292139d47aac1a"
|
||||
#define GITAUTH "Erik_Frojdh"
|
||||
#define GITREV 0x4488
|
||||
#define GITDATE 0x20190329
|
||||
#define GITREPUUID "969551ae373167dcfc28466f19e53a349da70f67"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4489
|
||||
#define GITDATE 0x20190401
|
||||
#define GITBRANCH "program"
|
||||
|
@ -3279,19 +3279,6 @@ int program_fpga(int file_des) {
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
|
||||
// not in programming mode
|
||||
if (debugflag != PROGRAMMING_MODE) {
|
||||
//to receive any arguments
|
||||
int n = 1;
|
||||
while (n > 0)
|
||||
n = receiveData(file_des, mess, MAX_STR_LENGTH, OTHER);
|
||||
ret = FAIL;
|
||||
sprintf(mess,"FPGA cannot be programmed in this mode. "
|
||||
"Restart on-board detector server with -update for programming mode.\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
|
||||
else {
|
||||
FILE_LOG(logINFOBLUE, ("Programming FPGA...\n"));
|
||||
|
||||
size_t filesize = 0;
|
||||
@ -3306,8 +3293,16 @@ int program_fpga(int file_des) {
|
||||
totalsize = filesize;
|
||||
FILE_LOG(logDEBUG1, ("Total program size is: %d\n", totalsize));
|
||||
|
||||
// not in programming mode
|
||||
/*if (debugflag != PROGRAMMING_MODE) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"FPGA cannot be programmed in this mode. "
|
||||
"Restart on-board detector server with -update for programming mode.\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}*/
|
||||
|
||||
// opening file pointer to flash and telling FPGA to not touch flash
|
||||
if (startWritingFPGAprogram(&fp) != OK) {
|
||||
if (ret != FAIL && startWritingFPGAprogram(&fp) != OK) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Could not write to flash. Error at startup.\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
@ -3378,7 +3373,7 @@ int program_fpga(int file_des) {
|
||||
basictests();
|
||||
initControlServer();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -3403,7 +3403,7 @@ int slsDetector::programFPGA(std::vector<char> buffer) {
|
||||
int fnum = F_PROGRAM_FPGA;
|
||||
int ret = FAIL;
|
||||
char mess[MAX_STR_LENGTH] = {0};
|
||||
FILE_LOG(logINFO) << "Sending programming binary to detector " << detector_shm()->hostname;
|
||||
FILE_LOG(logINFO) << "Sending programming binary to detector " << detId << " (" << detector_shm()->hostname << ")";
|
||||
|
||||
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
|
||||
auto client = DetectorSocket(detector_shm()->hostname, detector_shm()->controlPort);
|
||||
@ -3413,14 +3413,16 @@ int slsDetector::programFPGA(std::vector<char> buffer) {
|
||||
// opening error
|
||||
if (ret == FAIL) {
|
||||
client.receiveData(mess, sizeof(mess));
|
||||
throw RuntimeError("Detector " + std::to_string(detId) +
|
||||
" returned error: " + std::string(mess));
|
||||
std::ostringstream os;
|
||||
os << "Detector " << detId << " (" << detector_shm()->hostname << ")" <<
|
||||
" returned error: " << mess;
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
|
||||
// erasing flash
|
||||
if (ret != FAIL) {
|
||||
FILE_LOG(logINFO) << "This can take awhile. Please be patient...";
|
||||
FILE_LOG(logINFO) << detId << "Erasing Flash:";
|
||||
FILE_LOG(logINFO) << "Erasing Flash for detector " << detId << " (" << detector_shm()->hostname << ")";
|
||||
printf("%d%%\r", 0);
|
||||
std::cout << std::flush;
|
||||
// erasing takes 65 seconds, printing here (otherwise need threads
|
||||
@ -3434,7 +3436,7 @@ int slsDetector::programFPGA(std::vector<char> buffer) {
|
||||
std::cout << std::flush;
|
||||
}
|
||||
printf("\n");
|
||||
FILE_LOG(logINFO) << detId << "Writing to Flash:";
|
||||
FILE_LOG(logINFO) << "Writing to Flash to detector " << detId << " (" << detector_shm()->hostname << ")";
|
||||
printf("%d%%\r", 0);
|
||||
std::cout << std::flush;
|
||||
}
|
||||
@ -3464,8 +3466,10 @@ int slsDetector::programFPGA(std::vector<char> buffer) {
|
||||
} else {
|
||||
printf("\n");
|
||||
client.receiveData(mess, sizeof(mess));
|
||||
throw RuntimeError("Detector " + std::to_string(detId) +
|
||||
" returned error: " + std::string(mess));
|
||||
std::ostringstream os;
|
||||
os << "Detector " << detId << " (" << detector_shm()->hostname << ")" <<
|
||||
" returned error: " << mess;
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
@ -3476,8 +3480,10 @@ int slsDetector::programFPGA(std::vector<char> buffer) {
|
||||
client.receiveData(&ret, sizeof(ret));
|
||||
if (ret == FAIL) {
|
||||
client.receiveData(mess, sizeof(mess));
|
||||
throw RuntimeError("Detector " + std::to_string(detId) +
|
||||
" returned error: " + std::string(mess));
|
||||
std::ostringstream os;
|
||||
os << "Detector " << detId << " (" << detector_shm()->hostname << ")" <<
|
||||
" returned error: " << mess;
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3495,8 +3501,10 @@ int slsDetector::programFPGA(std::vector<char> buffer) {
|
||||
stop.receiveData(&stopret, sizeof(stopret));
|
||||
if (stopret == FAIL) {
|
||||
client.receiveData(mess, sizeof(mess));
|
||||
throw RuntimeError("Detector " + std::to_string(detId) +
|
||||
" returned error: " + std::string(mess));
|
||||
std::ostringstream os;
|
||||
os << "Detector " << detId << " (" << detector_shm()->hostname << ")" <<
|
||||
" returned error: " << mess;
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user