mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
commit
fc41d4313f
@ -54,6 +54,8 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
- added geometry to metadata
|
- added geometry to metadata
|
||||||
- 10g eiger nextframenumber get fixed.
|
- 10g eiger nextframenumber get fixed.
|
||||||
- stop, able to set nextframenumber to a consistent (max + 1) for all modules if different (eiger/ctb/jungfrau/moench)
|
- stop, able to set nextframenumber to a consistent (max + 1) for all modules if different (eiger/ctb/jungfrau/moench)
|
||||||
|
- fpga/kernel programming, checks if drive is a special file and not a normal file
|
||||||
|
- fpga/kernel programming, checks if drive is a special file and not a normal file
|
||||||
- gotthard 25 um image reconstructed in gui and virtual hdf5 (firmware updated for slave to reverse channels)
|
- gotthard 25 um image reconstructed in gui and virtual hdf5 (firmware updated for slave to reverse channels)
|
||||||
|
|
||||||
2. Resolved Issues
|
2. Resolved Issues
|
||||||
|
@ -1531,9 +1531,10 @@ void init_det(py::module &m) {
|
|||||||
Detector::setAdditionalJsonParameter,
|
Detector::setAdditionalJsonParameter,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("programFPGA",
|
.def("programFPGA",
|
||||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
(void (Detector::*)(const std::string &, const bool,
|
||||||
|
sls::Positions)) &
|
||||||
Detector::programFPGA,
|
Detector::programFPGA,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("resetFPGA",
|
.def("resetFPGA",
|
||||||
(void (Detector::*)(sls::Positions)) & Detector::resetFPGA,
|
(void (Detector::*)(sls::Positions)) & Detector::resetFPGA,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -26,10 +26,12 @@ int preparetoCopyProgram(char *mess, char *functionType, FILE **fd,
|
|||||||
uint64_t fsize);
|
uint64_t fsize);
|
||||||
int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
|
int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
|
||||||
char *functionType, char *clientChecksum,
|
char *functionType, char *clientChecksum,
|
||||||
ssize_t fsize);
|
ssize_t fsize, int forceDeleteNormalFile);
|
||||||
int getDrive(char *mess, enum PROGRAM_INDEX index);
|
int getDrive(char *mess, enum PROGRAM_INDEX index);
|
||||||
/** Notify fpga not to touch flash, open src and flash drive to write */
|
/** Notify fpga not to touch flash, open src and flash drive to write */
|
||||||
int openFileForFlash(char *mess, FILE **flashfd, FILE **srcfd);
|
int openFileForFlash(char *mess, enum PROGRAM_INDEX index, FILE **flashfd, FILE **srcfd,
|
||||||
|
int forceDeleteNormalFile);
|
||||||
|
int checkNormalFile(char *mess, enum PROGRAM_INDEX index, int forceDeleteNormalFile);
|
||||||
int eraseFlash(char *mess);
|
int eraseFlash(char *mess);
|
||||||
/* write from tmp file to flash */
|
/* write from tmp file to flash */
|
||||||
int writeToFlash(char *mess, ssize_t fsize, FILE *flashfd, FILE *srcfd);
|
int writeToFlash(char *mess, ssize_t fsize, FILE *flashfd, FILE *srcfd);
|
||||||
|
@ -285,7 +285,8 @@ int update_detector_server(int);
|
|||||||
int receive_program(int file_des, enum PROGRAM_INDEX index);
|
int receive_program(int file_des, enum PROGRAM_INDEX index);
|
||||||
void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
|
void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
|
||||||
char *functionType, uint64_t filesize,
|
char *functionType, uint64_t filesize,
|
||||||
char *checksum, char *serverName);
|
char *checksum, char *serverName,
|
||||||
|
int forceDeleteNormalFile);
|
||||||
void receive_program_default(int file_des, enum PROGRAM_INDEX index,
|
void receive_program_default(int file_des, enum PROGRAM_INDEX index,
|
||||||
char *functionType, uint64_t filesize,
|
char *functionType, uint64_t filesize,
|
||||||
char *checksum, char *serverName);
|
char *checksum, char *serverName);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "slsDetectorServer_defs.h"
|
#include "slsDetectorServer_defs.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
#include <unistd.h> // usleep
|
#include <unistd.h> // usleep
|
||||||
|
|
||||||
@ -38,6 +39,9 @@
|
|||||||
|
|
||||||
#define CMD_GET_AMD_FLASH "dmesg | grep Amd"
|
#define CMD_GET_AMD_FLASH "dmesg | grep Amd"
|
||||||
|
|
||||||
|
#define CMD_CREATE_DEVICE_FILE_PART1 "mknod"
|
||||||
|
#define CMD_CREATE_DEVICE_FILE_PART2 "c 90 6"
|
||||||
|
|
||||||
#define FLASH_BUFFER_MEMORY_SIZE (128 * 1024) // 500 KB
|
#define FLASH_BUFFER_MEMORY_SIZE (128 * 1024) // 500 KB
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
@ -274,7 +278,8 @@ int allowUpdate(char *mess, char *functionType) {
|
|||||||
getKernelVersion(retvals);
|
getKernelVersion(retvals);
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not update %s. Kernel version %s is too old to "
|
"Could not update %s. Kernel version %s is too old to "
|
||||||
"update the Amd flash/ root directory. Most likely, blackfin needs rescue or replacement. Please contact us.\n",
|
"update the Amd flash/ root directory. Most likely, blackfin "
|
||||||
|
"needs rescue or replacement. Please contact us.\n",
|
||||||
functionType, retvals);
|
functionType, retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -319,7 +324,7 @@ int preparetoCopyProgram(char *mess, char *functionType, FILE **fd,
|
|||||||
|
|
||||||
int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
|
int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
|
||||||
char *functionType, char *clientChecksum,
|
char *functionType, char *clientChecksum,
|
||||||
ssize_t fsize) {
|
ssize_t fsize, int forceDeleteNormalFile) {
|
||||||
|
|
||||||
memset(messageType, 0, sizeof(messageType));
|
memset(messageType, 0, sizeof(messageType));
|
||||||
strcpy(messageType, functionType);
|
strcpy(messageType, functionType);
|
||||||
@ -330,7 +335,8 @@ int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
|
|||||||
|
|
||||||
FILE *flashfd = NULL;
|
FILE *flashfd = NULL;
|
||||||
FILE *srcfd = NULL;
|
FILE *srcfd = NULL;
|
||||||
if (openFileForFlash(mess, &flashfd, &srcfd) == FAIL) {
|
if (openFileForFlash(mess, index, &flashfd, &srcfd, forceDeleteNormalFile) ==
|
||||||
|
FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,7 +440,8 @@ int getDrive(char *mess, enum PROGRAM_INDEX index) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int openFileForFlash(char *mess, FILE **flashfd, FILE **srcfd) {
|
int openFileForFlash(char *mess, enum PROGRAM_INDEX index, FILE **flashfd, FILE **srcfd,
|
||||||
|
int forceDeleteNormalFile) {
|
||||||
// open src file
|
// open src file
|
||||||
*srcfd = fopen(TEMP_PROG_FILE_NAME, "r");
|
*srcfd = fopen(TEMP_PROG_FILE_NAME, "r");
|
||||||
if (*srcfd == NULL) {
|
if (*srcfd == NULL) {
|
||||||
@ -447,6 +454,11 @@ int openFileForFlash(char *mess, FILE **flashfd, FILE **srcfd) {
|
|||||||
}
|
}
|
||||||
LOG(logDEBUG1, ("Temp file ready for reading\n"));
|
LOG(logDEBUG1, ("Temp file ready for reading\n"));
|
||||||
|
|
||||||
|
if (checkNormalFile(mess, index, forceDeleteNormalFile) == FAIL) {
|
||||||
|
fclose(*srcfd);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
// open flash drive for writing
|
// open flash drive for writing
|
||||||
*flashfd = fopen(flashDriveName, "w");
|
*flashfd = fopen(flashDriveName, "w");
|
||||||
if (*flashfd == NULL) {
|
if (*flashfd == NULL) {
|
||||||
@ -462,6 +474,95 @@ int openFileForFlash(char *mess, FILE **flashfd, FILE **srcfd) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int checkNormalFile(char *mess, enum PROGRAM_INDEX index, int forceDeleteNormalFile) {
|
||||||
|
#ifndef VIRTUAL
|
||||||
|
// check if its a normal file or special file
|
||||||
|
struct stat buf;
|
||||||
|
if (stat(flashDriveName, &buf) == -1) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not %s. Unable to find the flash drive %s\n",
|
||||||
|
messageType, flashDriveName);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
// zero = normal file (not char special drive file)
|
||||||
|
if (!S_ISCHR(buf.st_mode)) {
|
||||||
|
// kernel memory is not permanent
|
||||||
|
if (index != PROGRAM_FPGA) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not %s. The flash drive found is a normal file. "
|
||||||
|
"Reboot board using 'rebootcontroller' command to load "
|
||||||
|
"proper device tree\n",
|
||||||
|
messageType);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// user does not allow to fix it (default)
|
||||||
|
if (forceDeleteNormalFile == 0) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not %s. The flash drive %s found for fpga programming is a normal file. To "
|
||||||
|
"fix this (by deleting this file, creating the flash drive and proceeding with "
|
||||||
|
"programming), re-run the programming command 'programfpga' with parameter "
|
||||||
|
"'--force-delete-normal-file'\n",
|
||||||
|
messageType, flashDriveName);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fpga memory stays after a reboot, user allowed to fix it
|
||||||
|
LOG(logWARNING, ("Flash drive invalidated (normal file). Fixing it...\n"));
|
||||||
|
|
||||||
|
// user allows to fix it, so force delete normal file
|
||||||
|
char cmd[MAX_STR_LENGTH] = {0};
|
||||||
|
char retvals[MAX_STR_LENGTH] = {0};
|
||||||
|
|
||||||
|
if (snprintf(cmd, MAX_STR_LENGTH, "rm %s", flashDriveName) >=
|
||||||
|
MAX_STR_LENGTH) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not update %s. Command to delete normal file %s is "
|
||||||
|
"too long\n",
|
||||||
|
messageType, flashDriveName);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
|
||||||
|
snprintf(
|
||||||
|
mess, MAX_STR_LENGTH,
|
||||||
|
"Could not update %s. (could not delete normal file %s: %s)\n",
|
||||||
|
messageType, flashDriveName, retvals);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("\tDeleted Normal File (%s)\n", flashDriveName));
|
||||||
|
|
||||||
|
// create special drive
|
||||||
|
if (snprintf(cmd, MAX_STR_LENGTH, "%s %s %s",
|
||||||
|
CMD_CREATE_DEVICE_FILE_PART1, flashDriveName,
|
||||||
|
CMD_CREATE_DEVICE_FILE_PART2) >= MAX_STR_LENGTH) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not update %s. Command to create special file %s is "
|
||||||
|
"too long\n",
|
||||||
|
messageType, flashDriveName);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
|
||||||
|
snprintf(
|
||||||
|
mess, MAX_STR_LENGTH,
|
||||||
|
"Could not update %s. (could not create special file %s: %s)\n",
|
||||||
|
messageType, flashDriveName, retvals);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("\tSpecial File created (%s)\n", flashDriveName));
|
||||||
|
} else {
|
||||||
|
LOG(logINFO, ("\tValidated flash drive (not a normal file)\n"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
int eraseFlash(char *mess) {
|
int eraseFlash(char *mess) {
|
||||||
LOG(logINFO, ("\tErasing Flash...\n"));
|
LOG(logINFO, ("\tErasing Flash...\n"));
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h> // usleep
|
#include <unistd.h> // usleep
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
/* global variables */
|
/* global variables */
|
||||||
|
|
||||||
@ -146,6 +147,30 @@ int getDrive(char *mess, enum PROGRAM_INDEX index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int openFileForFlash(char *mess, FILE **flashfd) {
|
int openFileForFlash(char *mess, FILE **flashfd) {
|
||||||
|
#ifndef VIRTUAL
|
||||||
|
// check if its a normal file or special file
|
||||||
|
struct stat buf;
|
||||||
|
if (stat(flashDriveName, &buf) == -1) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not %s. Unable to find the flash drive %s\n",
|
||||||
|
messageType, flashDriveName);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
// zero = normal file (not char drive special file)
|
||||||
|
if (!S_ISCHR(buf.st_mode)) {
|
||||||
|
// memory is not permanent
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not %s. The flash drive found is a normal file. "
|
||||||
|
"Reboot board using 'rebootcontroller' command to load "
|
||||||
|
"proper device tree\n",
|
||||||
|
messageType);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("\tValidated flash drive (not a normal file)\n"));
|
||||||
|
#endif
|
||||||
|
|
||||||
*flashfd = fopen(flashDriveName, "w");
|
*flashfd = fopen(flashDriveName, "w");
|
||||||
if (*flashfd == NULL) {
|
if (*flashfd == NULL) {
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
|
@ -4003,7 +4003,8 @@ int check_version(int file_des) {
|
|||||||
usleep(3 * 1000 * 1000);
|
usleep(3 * 1000 * 1000);
|
||||||
if (!isInitCheckDone()) {
|
if (!isInitCheckDone()) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess, "Server Initialization still not done done in server. Unexpected.\n");
|
strcpy(mess, "Server Initialization still not done done in server. "
|
||||||
|
"Unexpected.\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9443,6 +9444,15 @@ int receive_program(int file_des, enum PROGRAM_INDEX index) {
|
|||||||
LOG(logINFO, ("\tServer Name: %s\n", serverName));
|
LOG(logINFO, ("\tServer Name: %s\n", serverName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(GOTTHARD2D) && !defined(MYTHEN3D) && !defined(EIGERD)
|
||||||
|
int forceDeleteNormalFile = 0;
|
||||||
|
if (receiveData(file_des, &forceDeleteNormalFile,
|
||||||
|
sizeof(forceDeleteNormalFile), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
LOG(logINFO,
|
||||||
|
("\tForce Delete Normal File flag? %s\n", (forceDeleteNormalFile ? "Y" : "N")));
|
||||||
|
#endif
|
||||||
|
|
||||||
// in same folder as current process (will also work for virtual then
|
// in same folder as current process (will also work for virtual then
|
||||||
// with write permissions)
|
// with write permissions)
|
||||||
{
|
{
|
||||||
@ -9467,7 +9477,7 @@ int receive_program(int file_des, enum PROGRAM_INDEX index) {
|
|||||||
checksum, serverName);
|
checksum, serverName);
|
||||||
#else
|
#else
|
||||||
receive_program_via_blackfin(file_des, index, functionType,
|
receive_program_via_blackfin(file_des, index, functionType,
|
||||||
filesize, checksum, serverName);
|
filesize, checksum, serverName, forceDeleteNormalFile);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9483,7 +9493,7 @@ int receive_program(int file_des, enum PROGRAM_INDEX index) {
|
|||||||
|
|
||||||
void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
|
void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
|
||||||
char *functionType, uint64_t filesize,
|
char *functionType, uint64_t filesize,
|
||||||
char *checksum, char *serverName) {
|
char *checksum, char *serverName, int forceDeleteNormalFile) {
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && \
|
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && \
|
||||||
!defined(GOTTHARDD)
|
!defined(GOTTHARDD)
|
||||||
@ -9582,7 +9592,7 @@ void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
|
|||||||
case PROGRAM_FPGA:
|
case PROGRAM_FPGA:
|
||||||
case PROGRAM_KERNEL:
|
case PROGRAM_KERNEL:
|
||||||
ret = eraseAndWriteToFlash(mess, index, functionType, checksum,
|
ret = eraseAndWriteToFlash(mess, index, functionType, checksum,
|
||||||
totalsize);
|
totalsize, forceDeleteNormalFile);
|
||||||
break;
|
break;
|
||||||
case PROGRAM_SERVER:
|
case PROGRAM_SERVER:
|
||||||
ret = moveBinaryFile(mess, serverName, TEMP_PROG_FILE_NAME,
|
ret = moveBinaryFile(mess, serverName, TEMP_PROG_FILE_NAME,
|
||||||
@ -9785,12 +9795,16 @@ int set_top(int file_des) {
|
|||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
if (arg != 0 && arg != 1) {
|
if (arg != 0 && arg != 1) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Could not set top mode. Invalid value: %d. Must be 0 or 1\n", arg);
|
sprintf(
|
||||||
|
mess,
|
||||||
|
"Could not set top mode. Invalid value: %d. Must be 0 or 1\n",
|
||||||
|
arg);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
ret = setTop(arg == 1 ? OW_TOP : OW_BOTTOM);
|
ret = setTop(arg == 1 ? OW_TOP : OW_BOTTOM);
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
sprintf(mess, "Could not set %s\n", (arg == 1 ? "Top" : "Bottom"));
|
sprintf(mess, "Could not set %s\n",
|
||||||
|
(arg == 1 ? "Top" : "Bottom"));
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
@ -1747,10 +1747,13 @@ class Detector {
|
|||||||
/** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2]
|
/** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2]
|
||||||
* Advanced user Function!
|
* Advanced user Function!
|
||||||
* Program firmware from command line, after which detector controller is
|
* Program firmware from command line, after which detector controller is
|
||||||
* rebooted. [Jungfrau][CTB][Moench] fname is a pof file (full path) \n
|
* rebooted. forceDeleteNormalFile is true, if normal file found
|
||||||
* [Mythen3][Gotthard2] fname is an rbf file (full path)
|
* in device tree, it must be deleted, a new device drive created and
|
||||||
|
* programming continued.[Jungfrau][CTB][Moench] fname is a pof file (full
|
||||||
|
* path) \n [Mythen3][Gotthard2] fname is an rbf file (full path)
|
||||||
*/
|
*/
|
||||||
void programFPGA(const std::string &fname, Positions pos = {});
|
void programFPGA(const std::string &fname, const bool forceDeleteNormalFile,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
/** [Jungfrau][CTB][Moench] Advanced user Function! */
|
/** [Jungfrau][CTB][Moench] Advanced user Function! */
|
||||||
void resetFPGA(Positions pos = {});
|
void resetFPGA(Positions pos = {});
|
||||||
|
@ -2832,19 +2832,31 @@ std::string CmdProxy::ProgramFpga(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[fname.pof | fname.rbf (full path)]\n\t[Jungfrau][Ctb][Moench] "
|
os << "[fname.pof | fname.rbf (full "
|
||||||
"Programs FPGA from pof file (full path). Then, detector "
|
"path)][(opitonal)--force-delete-normal-file]\n\t[Jungfrau][Ctb]["
|
||||||
"controller is rebooted \n\t[Mythen3][Gotthard2] Programs FPGA "
|
"Moench] Programs FPGA from pof file (full path). Then, detector "
|
||||||
"from rbf file (full path). Then, detector controller is "
|
"controller is rebooted. \n\t\tUse --force-delete-normal-file "
|
||||||
"rebooted."
|
"argument, if normal file found in device tree, it must be "
|
||||||
|
"deleted, a new device drive created and programming "
|
||||||
|
"continued.\n\t[Mythen3][Gotthard2] Programs FPGA from rbf file "
|
||||||
|
"(full path). Then, detector controller is rebooted."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
throw sls::RuntimeError("Cannot get");
|
throw sls::RuntimeError("Cannot get");
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
if (args.size() != 1) {
|
bool forceDeteleNormalFile = false;
|
||||||
|
if (args.size() == 2) {
|
||||||
|
if (args[1] != "--force-delete-normal-file") {
|
||||||
|
throw sls::RuntimeError(
|
||||||
|
"Could not scan second argument. Did you "
|
||||||
|
"mean --force-delete-normal-file?");
|
||||||
|
}
|
||||||
|
forceDeteleNormalFile = true;
|
||||||
|
} else if (args.size() != 1) {
|
||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(1);
|
||||||
}
|
}
|
||||||
det->programFPGA(args[0], std::vector<int>{det_id});
|
det->programFPGA(args[0], forceDeteleNormalFile,
|
||||||
|
std::vector<int>{det_id});
|
||||||
os << "successful\n";
|
os << "successful\n";
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError("Unknown action");
|
throw sls::RuntimeError("Unknown action");
|
||||||
|
@ -2187,10 +2187,11 @@ void Detector::setAdditionalJsonParameter(const std::string &key,
|
|||||||
|
|
||||||
// Advanced
|
// Advanced
|
||||||
|
|
||||||
void Detector::programFPGA(const std::string &fname, Positions pos) {
|
void Detector::programFPGA(const std::string &fname,
|
||||||
|
const bool forceDeleteNormalFile, Positions pos) {
|
||||||
LOG(logINFO) << "Updating Firmware...";
|
LOG(logINFO) << "Updating Firmware...";
|
||||||
std::vector<char> buffer = pimpl->readProgrammingFile(fname);
|
std::vector<char> buffer = pimpl->readProgrammingFile(fname);
|
||||||
pimpl->Parallel(&Module::programFPGA, pos, buffer);
|
pimpl->Parallel(&Module::programFPGA, pos, buffer, forceDeleteNormalFile);
|
||||||
rebootController(pos);
|
rebootController(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2235,7 +2236,7 @@ void Detector::updateFirmwareAndServer(const std::string &sname,
|
|||||||
LOG(logINFO) << "Updating Firmware and Detector Server (with tftp)...";
|
LOG(logINFO) << "Updating Firmware and Detector Server (with tftp)...";
|
||||||
LOG(logINFO) << "Updating Detector Server (via tftp)...";
|
LOG(logINFO) << "Updating Detector Server (via tftp)...";
|
||||||
pimpl->Parallel(&Module::copyDetectorServer, pos, sname, hostname);
|
pimpl->Parallel(&Module::copyDetectorServer, pos, sname, hostname);
|
||||||
programFPGA(fname, pos);
|
programFPGA(fname, false, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::updateFirmwareAndServer(const std::string &sname,
|
void Detector::updateFirmwareAndServer(const std::string &sname,
|
||||||
@ -2246,7 +2247,7 @@ void Detector::updateFirmwareAndServer(const std::string &sname,
|
|||||||
std::vector<char> buffer = readBinaryFile(sname, "Update Detector Server");
|
std::vector<char> buffer = readBinaryFile(sname, "Update Detector Server");
|
||||||
std::string filename = sls::getFileNameFromFilePath(sname);
|
std::string filename = sls::getFileNameFromFilePath(sname);
|
||||||
pimpl->Parallel(&Module::updateDetectorServer, pos, buffer, filename);
|
pimpl->Parallel(&Module::updateDetectorServer, pos, buffer, filename);
|
||||||
programFPGA(fname, pos);
|
programFPGA(fname, false, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getUpdateMode(Positions pos) const {
|
Result<bool> Detector::getUpdateMode(Positions pos) const {
|
||||||
|
@ -2590,12 +2590,14 @@ void Module::setAdditionalJsonParameter(const std::string &key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Advanced
|
// Advanced
|
||||||
void Module::programFPGA(std::vector<char> buffer) {
|
void Module::programFPGA(std::vector<char> buffer,
|
||||||
|
const bool forceDeleteNormalFile) {
|
||||||
switch (shm()->detType) {
|
switch (shm()->detType) {
|
||||||
case JUNGFRAU:
|
case JUNGFRAU:
|
||||||
case CHIPTESTBOARD:
|
case CHIPTESTBOARD:
|
||||||
case MOENCH:
|
case MOENCH:
|
||||||
sendProgram(true, buffer, F_PROGRAM_FPGA, "Update Firmware");
|
sendProgram(true, buffer, F_PROGRAM_FPGA, "Update Firmware", "",
|
||||||
|
forceDeleteNormalFile);
|
||||||
break;
|
break;
|
||||||
case MYTHEN3:
|
case MYTHEN3:
|
||||||
case GOTTHARD2:
|
case GOTTHARD2:
|
||||||
@ -3582,7 +3584,8 @@ sls_detector_module Module::readSettingsFile(const std::string &fname,
|
|||||||
void Module::sendProgram(bool blackfin, std::vector<char> buffer,
|
void Module::sendProgram(bool blackfin, std::vector<char> buffer,
|
||||||
const int functionEnum,
|
const int functionEnum,
|
||||||
const std::string &functionType,
|
const std::string &functionType,
|
||||||
const std::string serverName) {
|
const std::string serverName,
|
||||||
|
const bool forceDeleteNormalFile) {
|
||||||
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
|
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
|
||||||
<< "): Sending " << functionType;
|
<< "): Sending " << functionType;
|
||||||
|
|
||||||
@ -3606,6 +3609,11 @@ void Module::sendProgram(bool blackfin, std::vector<char> buffer,
|
|||||||
client.Send(sname);
|
client.Send(sname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send forceDeleteNormalFile flag
|
||||||
|
if (blackfin) {
|
||||||
|
client.Send(static_cast<int>(forceDeleteNormalFile));
|
||||||
|
}
|
||||||
|
|
||||||
// validate memory allocation etc in detector
|
// validate memory allocation etc in detector
|
||||||
if (client.Receive<int>() == FAIL) {
|
if (client.Receive<int>() == FAIL) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
@ -545,7 +545,8 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
* Advanced *
|
* Advanced *
|
||||||
* *
|
* *
|
||||||
* ************************************************/
|
* ************************************************/
|
||||||
void programFPGA(std::vector<char> buffer);
|
void programFPGA(std::vector<char> buffer,
|
||||||
|
const bool forceDeleteNormalFile);
|
||||||
void resetFPGA();
|
void resetFPGA();
|
||||||
void copyDetectorServer(const std::string &fname,
|
void copyDetectorServer(const std::string &fname,
|
||||||
const std::string &hostname);
|
const std::string &hostname);
|
||||||
@ -760,7 +761,8 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
bool trimbits = true);
|
bool trimbits = true);
|
||||||
void sendProgram(bool blackfin, std::vector<char> buffer,
|
void sendProgram(bool blackfin, std::vector<char> buffer,
|
||||||
const int functionEnum, const std::string &functionType,
|
const int functionEnum, const std::string &functionType,
|
||||||
const std::string serverName = "");
|
const std::string serverName = "",
|
||||||
|
const bool forceDeleteNormalFile = false);
|
||||||
void simulatingActivityinDetector(const std::string &functionType,
|
void simulatingActivityinDetector(const std::string &functionType,
|
||||||
const int timeRequired);
|
const int timeRequired);
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
#define APIRECEIVER 0x211124
|
#define APIRECEIVER 0x211124
|
||||||
#define APIGUI 0x211124
|
#define APIGUI 0x211124
|
||||||
|
|
||||||
#define APICTB 0x220318
|
#define APIEIGER 0x220324
|
||||||
#define APIGOTTHARD 0x220318
|
#define APICTB 0x220328
|
||||||
#define APIGOTTHARD2 0x220318
|
#define APIGOTTHARD 0x220328
|
||||||
#define APIJUNGFRAU 0x220318
|
#define APIGOTTHARD2 0x220328
|
||||||
#define APIMYTHEN3 0x220318
|
#define APIJUNGFRAU 0x220328
|
||||||
#define APIMOENCH 0x220318
|
#define APIMYTHEN3 0x220328
|
||||||
#define APIEIGER 0x220318
|
#define APIMOENCH 0x220328
|
||||||
|
Loading…
x
Reference in New Issue
Block a user