mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-28 17:10:03 +02:00
wip
This commit is contained in:
parent
2ef3dac39e
commit
c3a26fdcaf
@ -1266,7 +1266,6 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
|||||||
<< "Updating Firmware. This can take awhile. Please be patient...";
|
<< "Updating Firmware. This can take awhile. Please be patient...";
|
||||||
LOG(logDEBUG1) << "Programming FPGA with file name:" << fname;
|
LOG(logDEBUG1) << "Programming FPGA with file name:" << fname;
|
||||||
|
|
||||||
size_t filesize = 0;
|
|
||||||
// check if it exists
|
// check if it exists
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(fname.c_str(), &st) != 0) {
|
if (stat(fname.c_str(), &st) != 0) {
|
||||||
@ -1294,6 +1293,7 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
|||||||
|
|
||||||
// convert src to dst rawbin
|
// convert src to dst rawbin
|
||||||
LOG(logDEBUG1) << "Converting " << fname << " to " << destfname;
|
LOG(logDEBUG1) << "Converting " << fname << " to " << destfname;
|
||||||
|
LOG(logINFO) << "Converting program to rawbin";
|
||||||
{
|
{
|
||||||
constexpr int pofNumHeaderBytes = 0x11C;
|
constexpr int pofNumHeaderBytes = 0x11C;
|
||||||
constexpr int pofFooterOfst = 0x1000000;
|
constexpr int pofFooterOfst = 0x1000000;
|
||||||
@ -1314,15 +1314,18 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
|||||||
// Swap bits from source and write to dest
|
// Swap bits from source and write to dest
|
||||||
while (!feof(src)) {
|
while (!feof(src)) {
|
||||||
// print progress
|
// print progress
|
||||||
LOG(logINFO) << "Converting program to rawbin";
|
if (isPof) {
|
||||||
printf("%d%%\r",
|
printf("pofFooterOfst:%d, dstfilepos:%d %d%%\r", pofFooterOfst,
|
||||||
(int)(((double)(pofFooterOfst - dstFilePos) / pofFooterOfst) *
|
dstFilePos,
|
||||||
|
(int)(((double)(pofFooterOfst - dstFilePos) /
|
||||||
|
pofFooterOfst) *
|
||||||
100));
|
100));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
// pof: exit early to discard footer
|
// pof: exit early to discard footer
|
||||||
if (isPof && dstFilePos >= pofFooterOfst) {
|
if (dstFilePos >= pofFooterOfst) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// read source
|
// read source
|
||||||
int s = fgetc(src);
|
int s = fgetc(src);
|
||||||
if (s < 0) {
|
if (s < 0) {
|
||||||
@ -1358,7 +1361,7 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
|||||||
if (fseek(fp, 0, SEEK_END) != 0) {
|
if (fseek(fp, 0, SEEK_END) != 0) {
|
||||||
throw RuntimeError("Program FPGA: Seek error in rawbin file");
|
throw RuntimeError("Program FPGA: Seek error in rawbin file");
|
||||||
}
|
}
|
||||||
filesize = ftell(fp);
|
size_t filesize = ftell(fp);
|
||||||
if (filesize <= 0) {
|
if (filesize <= 0) {
|
||||||
throw RuntimeError("Program FPGA: Could not get length of rawbin file");
|
throw RuntimeError("Program FPGA: Could not get length of rawbin file");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user