mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-05 17:40:40 +02:00
removed update shared memory from detector, check if eiger firmware >=26: have same top and bottom addresses
This commit is contained in:
parent
9f3ad4e2f4
commit
07cd71f0c7
Binary file not shown.
Binary file not shown.
@ -327,7 +327,14 @@ void initControlServer() {
|
||||
getModuleConfiguration();
|
||||
Feb_Interface_FebInterface();
|
||||
Feb_Control_FebControl();
|
||||
Feb_Control_Init(master,top,normal, getDetectorNumber());
|
||||
// different addresses for top and bottom
|
||||
if (getFirmwareVersion() < FIRMWARE_VERSION_SAME_TOP_BOT_ADDR) {
|
||||
Feb_Control_Init(master,top,normal, getDetectorNumber());
|
||||
}
|
||||
// same addresses for top and bottom
|
||||
else {
|
||||
Feb_Control_Init(master,1, normal, getDetectorNumber());
|
||||
}
|
||||
//master of 9M, check high voltage serial communication to blackfin
|
||||
if (master && !normal) {
|
||||
if (Feb_Control_OpenSerialCommunication())
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#define REQUIRED_FIRMWARE_VERSION (24)
|
||||
#define IDFILECOMMAND "more /home/root/executables/detid.txt"
|
||||
#define FIRMWARE_VERSION_SAME_TOP_BOT_ADDR (26)
|
||||
|
||||
#define STATUS_IDLE 0
|
||||
#define STATUS_RUNNING 1
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -88,8 +88,6 @@ int exit_server(int);
|
||||
int lock_server(int);
|
||||
int get_last_client_ip(int);
|
||||
int set_port(int);
|
||||
int update_client(int);
|
||||
int send_update(int);
|
||||
int calibrate_pedestal(int);
|
||||
int enable_ten_giga(int);
|
||||
int set_all_trimbits(int);
|
||||
|
@ -579,10 +579,6 @@ int Server_VerifyLock() {
|
||||
|
||||
int Server_SendResult(int fileDes, intType itype, int update, void* retval, int retvalSize) {
|
||||
|
||||
// update if different clients (ret can be ok or acquisition finished), not fail to not overwrite e message
|
||||
if (update && isControlServer && ret != FAIL && differentClients)
|
||||
ret = FORCE_UPDATE;
|
||||
|
||||
// send success of operation
|
||||
int ret1 = ret;
|
||||
sendData(fileDes, &ret1,sizeof(ret1), INT32);
|
||||
|
@ -108,7 +108,6 @@ const char* getRetName() {
|
||||
switch(ret) {
|
||||
case OK: return "OK";
|
||||
case FAIL: return "FAIL";
|
||||
case FORCE_UPDATE: return "FORCE_UPDATE";
|
||||
case GOODBYE: return "GOODBYE";
|
||||
case REBOOT: return "REBOOT";
|
||||
default: return "unknown";
|
||||
@ -194,7 +193,6 @@ const char* getFunctionName(enum detFuncs func) {
|
||||
case F_LOCK_SERVER: return "F_LOCK_SERVER";
|
||||
case F_GET_LAST_CLIENT_IP: return "F_GET_LAST_CLIENT_IP";
|
||||
case F_SET_PORT: return "F_SET_PORT";
|
||||
case F_UPDATE_CLIENT: return "F_UPDATE_CLIENT";
|
||||
case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA";
|
||||
case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS";
|
||||
case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL";
|
||||
@ -388,7 +386,6 @@ void function_table() {
|
||||
flist[F_LOCK_SERVER] = &lock_server;
|
||||
flist[F_GET_LAST_CLIENT_IP] = &get_last_client_ip;
|
||||
flist[F_SET_PORT] = &set_port;
|
||||
flist[F_UPDATE_CLIENT] = &update_client;
|
||||
flist[F_ENABLE_TEN_GIGA] = &enable_ten_giga;
|
||||
flist[F_SET_ALL_TRIMBITS] = &set_all_trimbits;
|
||||
flist[F_SET_PATTERN_IO_CONTROL] = &set_pattern_io_control;
|
||||
@ -2830,58 +2827,6 @@ int set_port(int file_des) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int update_client(int file_des) {
|
||||
ret = FORCE_UPDATE;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
Server_SendResult(file_des, INT32, NO_UPDATE, NULL, 0);
|
||||
return send_update(file_des);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int send_update(int file_des) {
|
||||
ret = OK;
|
||||
int n = 0;
|
||||
int i32 = -1;
|
||||
|
||||
i32 = lastClientIP;
|
||||
i32 = __builtin_bswap32(i32);
|
||||
n = sendData(file_des, &i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// number of channels
|
||||
#if defined(MOENCHD) || defined(CHIPTESTBOARDD)
|
||||
{
|
||||
int nx = 0, ny = 0;
|
||||
getNumberOfChannels(&nx, &ny);
|
||||
i32 = nx;
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
i32 = ny;
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
}
|
||||
#endif
|
||||
|
||||
// num udp interfaces
|
||||
#ifdef JUNGFRAUD
|
||||
i32 = getNumberofUDPInterfaces();
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
if (lockStatus == 0) {
|
||||
lastClientIP = thisClientIP;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int enable_ten_giga(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
@ -3853,7 +3798,6 @@ int reset_fpga(int file_des) {
|
||||
initControlServer();
|
||||
}
|
||||
else initStopServer(); //remapping of stop server
|
||||
ret = FORCE_UPDATE;
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
|
@ -137,12 +137,8 @@ int64_t Module::getReceiverSoftwareVersion() const {
|
||||
void Module::sendToDetector(int fnum, const void *args, size_t args_size,
|
||||
void *retval, size_t retval_size) {
|
||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||
auto ret =
|
||||
client.sendCommandThenRead(fnum, args, args_size, retval, retval_size);
|
||||
client.sendCommandThenRead(fnum, args, args_size, retval, retval_size);
|
||||
client.close();
|
||||
if (ret == FORCE_UPDATE) {
|
||||
updateCachedDetectorVariables();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Arg, typename Ret>
|
||||
@ -363,7 +359,6 @@ void Module::setHostname(const std::string &hostname, const bool initialChecks)
|
||||
}
|
||||
|
||||
LOG(logINFO) << "Detector connecting - updating!";
|
||||
updateCachedDetectorVariables();
|
||||
}
|
||||
|
||||
std::string Module::getHostname() const { return shm()->hostname; }
|
||||
@ -703,39 +698,6 @@ void Module::execCommand(const std::string &cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
void Module::updateCachedDetectorVariables() {
|
||||
int fnum = F_UPDATE_CLIENT;
|
||||
LOG(logDEBUG1) << "Sending update client to detector server";
|
||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||
if (client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0) ==
|
||||
FORCE_UPDATE) {
|
||||
int n = 0, i32 = 0;
|
||||
sls::IpAddr lastClientIP;
|
||||
n += client.Receive(&lastClientIP, sizeof(lastClientIP));
|
||||
LOG(logDEBUG1)
|
||||
<< "Updating detector last modified by " << lastClientIP;
|
||||
|
||||
// number of channels (depends on #samples, adcmask)
|
||||
if (shm()->myDetectorType == CHIPTESTBOARD ||
|
||||
shm()->myDetectorType == MOENCH) {
|
||||
n += client.Receive(&i32, sizeof(i32));
|
||||
shm()->nChan.x = i32;
|
||||
n += client.Receive(&i32, sizeof(i32));
|
||||
shm()->nChan.y = i32;
|
||||
}
|
||||
|
||||
// num udp interfaces
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
n += client.Receive(&i32, sizeof(i32));
|
||||
shm()->numUDPInterfaces = i32;
|
||||
}
|
||||
|
||||
if (n == 0) {
|
||||
LOG(logERROR) << "Could not update detector, received 0 bytes";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> Module::getConfigFileCommands() {
|
||||
std::vector<std::string> base{"hostname", "port", "stopport",
|
||||
"settingsdir", "fpath", "lock",
|
||||
@ -1563,8 +1525,6 @@ std::string Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
LOG(logWARNING) << "Acquisition already running, Stopping it.";
|
||||
stopAcquisition();
|
||||
}
|
||||
// update detector before receiver
|
||||
updateCachedDetectorVariables();
|
||||
|
||||
// start updating
|
||||
std::string host = receiverIP;
|
||||
@ -2169,9 +2129,6 @@ std::vector<int> Module::getVetoPhoton(const int chipIndex) {
|
||||
client.Receive(adus, sizeof(adus));
|
||||
std::vector<int> retvals(adus, adus + nch);
|
||||
LOG(logDEBUG1) << "Getting veto photon [" << chipIndex << "]: " << nch << " channels\n";
|
||||
if (ret == FORCE_UPDATE) {
|
||||
updateCachedDetectorVariables();
|
||||
}
|
||||
return retvals;
|
||||
}
|
||||
}
|
||||
@ -2258,11 +2215,7 @@ void Module::setVetoPhoton(const int chipIndex, const int numPhotons, const int
|
||||
client.Receive(mess, MAX_STR_LENGTH);
|
||||
throw RuntimeError("Detector " + std::to_string(detId) +
|
||||
" returned error: " + std::string(mess));
|
||||
} else {
|
||||
if (ret == FORCE_UPDATE) {
|
||||
updateCachedDetectorVariables();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Module::setVetoReference(const int gainIndex, const int value) {
|
||||
@ -2830,22 +2783,15 @@ void Module::setModule(sls_detector_module &module, int tb) {
|
||||
}
|
||||
client.Receive(&retval, sizeof(retval));
|
||||
LOG(logDEBUG1) << "Set Module returned: " << retval;
|
||||
if (ret == FORCE_UPDATE) {
|
||||
updateCachedDetectorVariables();
|
||||
}
|
||||
}
|
||||
|
||||
sls_detector_module Module::getModule() {
|
||||
int fnum = F_GET_MODULE;
|
||||
int ret = FAIL;
|
||||
LOG(logDEBUG1) << "Getting module";
|
||||
sls_detector_module myMod{shm()->myDetectorType};
|
||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||
ret = client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0);
|
||||
client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0);
|
||||
receiveModule(&myMod, client);
|
||||
if (ret == FORCE_UPDATE) {
|
||||
updateCachedDetectorVariables();
|
||||
}
|
||||
return myMod;
|
||||
}
|
||||
|
||||
|
@ -271,11 +271,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
void execCommand(const std::string &cmd);
|
||||
|
||||
/**
|
||||
* Updates some of the shared memory receiving the data from the detector
|
||||
*/
|
||||
void updateCachedDetectorVariables();
|
||||
|
||||
/**
|
||||
* Get detector specific commands to write into config file
|
||||
* @returns vector of strings with commands
|
||||
|
@ -87,8 +87,7 @@ class slsDetectorDefs {
|
||||
/** return values */
|
||||
enum {
|
||||
OK, /**< function succeeded */
|
||||
FAIL, /**< function failed */
|
||||
FORCE_UPDATE
|
||||
FAIL /**< function failed */
|
||||
};
|
||||
|
||||
/** staus mask */
|
||||
|
@ -74,7 +74,6 @@ enum detFuncs{
|
||||
F_LOCK_SERVER,
|
||||
F_GET_LAST_CLIENT_IP,
|
||||
F_SET_PORT,
|
||||
F_UPDATE_CLIENT,
|
||||
F_ENABLE_TEN_GIGA,
|
||||
F_SET_ALL_TRIMBITS,
|
||||
F_SET_PATTERN_IO_CONTROL,
|
||||
@ -365,7 +364,6 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_LOCK_SERVER: return "F_LOCK_SERVER";
|
||||
case F_GET_LAST_CLIENT_IP: return "F_GET_LAST_CLIENT_IP";
|
||||
case F_SET_PORT: return "F_SET_PORT";
|
||||
case F_UPDATE_CLIENT: return "F_UPDATE_CLIENT";
|
||||
case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA";
|
||||
case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS";
|
||||
case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL";
|
||||
|
@ -1,12 +1,12 @@
|
||||
/** API versions */
|
||||
#define GITBRANCH "removeshm"
|
||||
#define APICTB 0x200402
|
||||
#define APIGOTTHARD 0x200402
|
||||
#define APIGOTTHARD2 0x200402
|
||||
#define APIJUNGFRAU 0x200402
|
||||
#define APIMYTHEN3 0x200402
|
||||
#define APIMOENCH 0x200331
|
||||
#define APILIB 0x200402
|
||||
#define APIRECEIVER 0x200402
|
||||
#define APIGUI 0x200331
|
||||
#define APICTB 0x200407
|
||||
#define APIGOTTHARD 0x200407
|
||||
#define APIGOTTHARD2 0x200407
|
||||
#define APIJUNGFRAU 0x200407
|
||||
#define APIMYTHEN3 0x200407
|
||||
#define APIMOENCH 0x200407
|
||||
#define APIEIGER 0x200407
|
||||
|
Loading…
x
Reference in New Issue
Block a user