mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-08 19:10:42 +02:00
wip
This commit is contained in:
parent
f0dce3c209
commit
22df4a8d5e
@ -3726,21 +3726,21 @@ int program_fpga(int file_des) {
|
|||||||
LOG(logINFOBLUE, ("Program size is: %lld\n",
|
LOG(logINFOBLUE, ("Program size is: %lld\n",
|
||||||
(long long unsigned int)filesize));
|
(long long unsigned int)filesize));
|
||||||
fpgasrc = malloc(filesize + 1);
|
fpgasrc = malloc(filesize + 1);
|
||||||
|
uint64_t totalsize = filesize + 1;
|
||||||
|
|
||||||
// writing to flash part by part
|
// writing to flash part by part
|
||||||
int clientSocketCrash = 0;
|
int clientSocketCrash = 0;
|
||||||
while (ret != FAIL && offset < filesize) {
|
while (ret != FAIL && filesize) {
|
||||||
|
|
||||||
uint64_t unitprogramsize = MAX_FPGAPROGRAMSIZE; // 2mb
|
uint64_t unitprogramsize = MAX_FPGAPROGRAMSIZE; // 2mb
|
||||||
if (offset + unitprogramsize > filesize) // less than 2mb
|
if (unitprogramsize > filesize) // less than 2mb
|
||||||
unitprogramsize = filesize - offset;
|
unitprogramsize = filesize;
|
||||||
LOG(logINFOBLUE, ("unit size to receive is:%lld [offset:%lld, filesize:%lld]\n",
|
LOG(logINFOBLUE, ("unit size to receive is:%lld [offset:%lld, filesize:%lld]\n",
|
||||||
(long long unsigned int)unitprogramsize,
|
(long long unsigned int)unitprogramsize,
|
||||||
(long long unsigned int)offset, (long long unsigned int)filesize));
|
(long long unsigned int)offset, (long long unsigned int)filesize));
|
||||||
|
|
||||||
// receive part of program
|
// receive part of program
|
||||||
if (receiveData(file_des, (char*)(fpgasrc + offset), unitprogramsize, OTHER) < 0) {
|
if (receiveData(file_des, fpgasrc, unitprogramsize, OTHER) < 0) {
|
||||||
printSocketReadError();
|
printSocketReadError();
|
||||||
clientSocketCrash = 1;
|
clientSocketCrash = 1;
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
@ -3750,13 +3750,14 @@ int program_fpga(int file_des) {
|
|||||||
else {
|
else {
|
||||||
LOG(logINFOBLUE, ("receiverd\n"));
|
LOG(logINFOBLUE, ("receiverd\n"));
|
||||||
offset += unitprogramsize;
|
offset += unitprogramsize;
|
||||||
|
filesize -= unitprogramsize;
|
||||||
Server_SendResult(file_des, INT32, NULL, 0);
|
Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
|
|
||||||
// print progress
|
// print progress
|
||||||
LOG(logINFOBLUE,
|
LOG(logINFOBLUE,
|
||||||
("Writing to Flash:%d%%\r",
|
("Writing to Flash:%d%%\r",
|
||||||
(int)(((double)(filesize - offset) / filesize) *
|
(int)(((double)(totalsize - filesize) / totalsize) *
|
||||||
100)));
|
100)));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3780,15 +3781,8 @@ int program_fpga(int file_des) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret != FAIL) {
|
if (ret != FAIL) {
|
||||||
fpgasrc[filesize] = '\0';
|
fpgasrc[totalsize] = '\0';
|
||||||
}
|
}
|
||||||
++filesize;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user