From 8cc0804f9997eff28d89cdaae5d2ba6db82f2bdf Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 3 Sep 2021 14:43:31 +0200 Subject: [PATCH] wip --- .../src/programFpgaBlackfin.c | 2 +- .../src/slsDetectorServer_funcs.c | 57 +++++++++---------- slsDetectorSoftware/src/DetectorImpl.cpp | 4 +- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c b/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c index 8306497ff..4bca01350 100644 --- a/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c +++ b/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c @@ -175,7 +175,7 @@ int startCopyingFPGAProgram(FILE **fd, uint64_t fsize, char *mess) { LOG(logERROR, (mess)); return FAIL; } - LOG(logINFO, ("ready to copy program to %s\n", TEMP_PROG_FILE_NAME)); + LOG(logINFO, ("Copying program to %s\n", TEMP_PROG_FILE_NAME)); return OK; } diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 1ee68ce56..ce808a202 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -3722,8 +3722,8 @@ int program_fpga(int file_des) { uint64_t filesize = 0; if (receiveData(file_des, &filesize, sizeof(filesize), INT64) < 0) return printSocketReadError(); - LOG(logINFOBLUE, ("Program size is: %lld\n", - (long long unsigned int)filesize)); + LOG(logDEBUG1, + ("Program size is: %lld\n", (long long unsigned int)filesize)); // open file and allocate memory for part program FILE *fd = NULL; @@ -3784,42 +3784,41 @@ int program_fpga(int file_des) { } free(src); fclose(fd); + LOG(logINFO, ("\tCopying done\n")); - /* if (ret != FAIL) { - fpgasrc[totalsize] = '\0'; - }*/ + /* if (ret != FAIL) { + fpgasrc[totalsize] = '\0'; + }*/ -/* + /* - // opening file pointer to flash and telling FPGA to not touch flash - if (startWritingFPGAprogram(&fp) != OK) { - ret = FAIL; - sprintf(mess, "Could not write to flash. Error at startup.\n"); - LOG(logERROR, (mess)); - } - Server_SendResult(file_des, INT32, NULL, 0); + // opening file pointer to flash and telling FPGA to not touch + flash if (startWritingFPGAprogram(&fp) != OK) { ret = FAIL; + sprintf(mess, "Could not write to flash. Error at + startup.\n"); LOG(logERROR, (mess)); + } + Server_SendResult(file_des, INT32, NULL, 0); - // erasing flash - if (ret != FAIL) { - eraseFlash(); - } + // erasing flash + if (ret != FAIL) { + eraseFlash(); + } - if (ret == OK) { - LOG(logINFO, ("Done copying program\n")); - // closing file pointer to flash and informing FPGA - ret = stopWritingFPGAprogram(fp); - if (ret == FAIL) { - strcpy(mess, "Failed to program fpga. FPGA is taking too long " - "to pick up program from flash! Try to flash " - "again without rebooting!\n"); - LOG(logERROR, (mess)); - } - } -*/ + if (ret == OK) { + LOG(logINFO, ("Done copying program\n")); + // closing file pointer to flash and informing FPGA + ret = stopWritingFPGAprogram(fp); + if (ret == FAIL) { + strcpy(mess, "Failed to program fpga. FPGA is taking too + long " "to pick up program from flash! Try to flash " "again without + rebooting!\n"); LOG(logERROR, (mess)); + } + } + */ #endif // end of Blackfin programming diff --git a/slsDetectorSoftware/src/DetectorImpl.cpp b/slsDetectorSoftware/src/DetectorImpl.cpp index edc4440a4..50348edaf 100644 --- a/slsDetectorSoftware/src/DetectorImpl.cpp +++ b/slsDetectorSoftware/src/DetectorImpl.cpp @@ -1293,7 +1293,7 @@ std::vector DetectorImpl::readProgrammingFile(const std::string &fname) { } // convert src to dst rawbin - LOG(logDEBUG1) << "Converting " << fname << " to " << destfname; + LOG(logINFOBLUE) << "Converting " << fname << " to " << destfname; { constexpr int pofNumHeaderBytes = 0x11C; constexpr int pofFooterOfst = 0x1000000; @@ -1342,7 +1342,7 @@ std::vector DetectorImpl::readProgrammingFile(const std::string &fname) { if (close(dst) != 0) { throw RuntimeError("Program FPGA: Could not close destination file"); } - LOG(logDEBUG1) << "File has been converted to " << destfname; + LOG(logINFOBLUE) << "File has been converted to " << destfname; // loading dst file to memory FILE *fp = fopen(destfname, "r");