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