This commit is contained in:
maliakal_d 2020-06-18 12:41:10 +02:00
parent ebc164aaa6
commit 7cc05ead89
19 changed files with 468 additions and 1232 deletions

View File

@ -60,7 +60,6 @@ int eiger_iodelay = 0;
int eiger_photonenergy = 0;
int eiger_dynamicrange = 0;
int eiger_parallelmode = 0;
int eiger_storeinmem = 0;
int eiger_overflow32 = 0;
int eiger_readoutspeed = 0;
int eiger_triggermode = 0;
@ -687,8 +686,7 @@ void setupDetector() {
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
eiger_photonenergy = DEFAULT_PHOTON_ENERGY;
setParallelMode(DEFAULT_PARALLEL_MODE);
setOverFlowMode(DEFAULT_READOUT_STOREINRAM_MODE);
setStoreInRamMode(DEFAULT_READOUT_OVERFLOW32_MODE);
setOverFlowMode(DEFAULT_READOUT_OVERFLOW32_MODE);
setClockDivider(RUN_CLK, DEFAULT_CLK_SPEED); // clk_devider,half speed
setIODelay(DEFAULT_IO_DELAY);
setTiming(DEFAULT_TIMING_MODE);
@ -805,14 +803,6 @@ int setOverFlowMode(int mode) {
int getOverFlowMode() { return eiger_overflow32; }
void setStoreInRamMode(int mode) {
mode = (mode == 0 ? 0 : 1);
LOG(logINFO, ("Setting Store in Ram mode to %d\n", mode));
eiger_storeinmem = mode;
}
int getStoreInRamMode() { return eiger_storeinmem; }
/* parameters - timer */
int setStartingFrameNumber(uint64_t value) {
@ -1118,37 +1108,6 @@ int setModule(sls_detector_module myMod, char *mess) {
return OK;
}
int getModule(sls_detector_module *myMod) {
#ifndef VIRTUAL
// trimbits
unsigned int *tt;
tt = Feb_Control_GetTrimbits();
// exclude gap pixels
int ip = 0, ich = 0;
for (int iy = 0; iy < 256; ++iy) {
for (int ichip = 0; ichip < 4; ++ichip) {
for (int ix = 0; ix < 256; ++iy) {
myMod->chanregs[ich++] = tt[ip++];
}
if (ichip < 3) {
ip++;
ip++;
}
}
}
#endif
// copy local module to myMod
if (detectorModules) {
if (copyModule(myMod, detectorModules) == FAIL)
return FAIL;
} else
return FAIL;
return OK;
}
enum detectorSettings setSettings(enum detectorSettings sett) {
if (sett == UNINITIALIZED) {
return thisSettings;
@ -2057,10 +2016,8 @@ int startStateMachine() {
LOG(logINFO, ("Going to start acquisition\n"));
Feb_Control_StartAcquisition();
if (!eiger_storeinmem) {
LOG(logINFO, ("requesting images right after start\n"));
ret = startReadOut();
}
LOG(logINFO, ("requesting images right after start\n"));
ret = startReadOut();
// wait for acquisition start
if (ret == OK) {
@ -2382,16 +2339,6 @@ void readFrame(int *ret, char *mess) {
}
LOG(logINFOGREEN, ("Acquisition finished\n"));
if (eiger_storeinmem) {
LOG(logINFO, ("requesting images after storing in memory\n"));
if (startReadOut() == FAIL) {
strcpy(mess, "Could not execute read image requests\n");
LOG(logERROR, (mess));
*ret = (int)FAIL;
return;
}
}
// wait for detector to send
int isTransmitting = 1;
while (isTransmitting) {

View File

@ -103,7 +103,6 @@ enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
#define DEFAULT_DYNAMIC_RANGE (16)
#define DEFAULT_PARALLEL_MODE (1)
#define DEFAULT_READOUT_STOREINRAM_MODE (0)
#define DEFAULT_READOUT_OVERFLOW32_MODE (0)
#define DEFAULT_CLK_SPEED (FULL_SPEED)
#define DEFAULT_IO_DELAY (650)

View File

@ -945,23 +945,6 @@ int setModule(sls_detector_module myMod, char *mess) {
return OK;
}
int getModule(sls_detector_module *myMod) {
for (int idac = 0; idac < NDAC; ++idac) {
if (dacValues[idac] >= 0)
*((myMod->dacs) + idac) = dacValues[idac];
}
// check if all of them are not initialized
int initialized = 0;
for (int idac = 0; idac < NDAC; ++idac) {
if (dacValues[idac] >= 0)
initialized = 1;
}
if (initialized) {
return OK;
}
return FAIL;
}
enum detectorSettings setSettings(enum detectorSettings sett) {
if (sett == UNINITIALIZED)
return thisSettings;

View File

@ -745,23 +745,6 @@ int setModule(sls_detector_module myMod, char *mess) {
return OK;
}
int getModule(sls_detector_module *myMod) {
for (int idac = 0; idac < NDAC; ++idac) {
if (dacValues[idac] >= 0)
*((myMod->dacs) + idac) = dacValues[idac];
}
// check if all of them are not initialized
int initialized = 0;
for (int idac = 0; idac < NDAC; ++idac) {
if (dacValues[idac] >= 0)
initialized = 1;
}
if (initialized) {
return OK;
}
return FAIL;
}
enum detectorSettings setSettings(enum detectorSettings sett) {
if (sett == UNINITIALIZED)
return thisSettings;

View File

@ -600,16 +600,6 @@ int setModule(sls_detector_module myMod, char *mess) {
return OK;
}
int getModule(sls_detector_module *myMod) {
// copy local module to myMod
if (detectorModules) {
if (copyModule(myMod, detectorModules) == FAIL)
return FAIL;
} else
return FAIL;
return OK;
}
int setBit(int ibit, int patword) { return patword |= (1 << ibit); }
int clearBit(int ibit, int patword) { return patword &= ~(1 << ibit); }

View File

@ -24,7 +24,6 @@ int receiveData(int file_des, void *buf, int length, intType itype);
int sendDataOnly(int file_des, void *buf, int length);
int receiveDataOnly(int file_des, void *buf, int length);
int sendModule(int file_des, sls_detector_module *myMod);
int receiveModule(int file_des, sls_detector_module *myMod);
/**

View File

@ -184,8 +184,6 @@ int setParallelMode(int mode);
int getParallelMode();
int setOverFlowMode(int mode);
int getOverFlowMode();
void setStoreInRamMode(int mode);
int getStoreInRamMode();
#endif
#ifdef CHIPTESTBOARDD
int setReadoutMode(enum readoutMode mode);
@ -276,7 +274,6 @@ int64_t getMeasurementTime();
// parameters - module, settings
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(GOTTHARD2D))
int setModule(sls_detector_module myMod, char *mess);
int getModule(sls_detector_module *myMod);
#endif
#ifdef MYTHEN3D
int setTrimbits(int *trimbits);

View File

@ -41,12 +41,10 @@ int get_adc(int);
int write_register(int);
int read_register(int);
int set_module(int);
int get_module(int);
int set_settings(int);
int get_threshold_energy(int);
int start_acquisition(int);
int stop_acquisition(int);
int start_readout(int);
int get_run_status(int);
int start_and_read_all(int);
int read_all(int);
@ -85,7 +83,6 @@ int get_measurement_time(int);
int set_dynamic_range(int);
int set_roi(int);
int get_roi(int);
int exit_server(int);
int lock_server(int);
int get_last_client_ip(int);
int set_port(int);
@ -181,8 +178,6 @@ int set_parallel_mode(int);
int get_parallel_mode(int);
int set_overflow_mode(int);
int get_overflow_mode(int);
int set_storeinram(int);
int get_storeinram(int);
int set_readout_mode(int);
int get_readout_mode(int);
int set_clock_frequency(int);

View File

@ -404,68 +404,6 @@ int receiveDataOnly(int file_des, void *buf, int length) {
return total_received;
}
int sendModule(int file_des, sls_detector_module *myMod) {
int ts = 0, n = 0;
n = sendData(file_des, &(myMod->serialnumber), sizeof(myMod->serialnumber),
INT32);
if (!n) {
return -1;
}
ts += n;
n = sendData(file_des, &(myMod->nchan), sizeof(myMod->nchan), INT32);
if (!n) {
return -1;
}
ts += n;
n = sendData(file_des, &(myMod->nchip), sizeof(myMod->nchip), INT32);
if (!n) {
return -1;
}
ts += n;
n = sendData(file_des, &(myMod->ndac), sizeof(myMod->ndac), INT32);
if (!n) {
return -1;
}
ts += n;
n = sendData(file_des, &(myMod->reg), sizeof(myMod->reg), INT32);
if (!n) {
return -1;
}
ts += n;
n = sendData(file_des, &(myMod->iodelay), sizeof(myMod->iodelay), INT32);
if (!n) {
return -1;
}
ts += n;
n = sendData(file_des, &(myMod->tau), sizeof(myMod->tau), INT32);
if (!n) {
return -1;
}
ts += n;
n = sendData(file_des, &(myMod->eV), sizeof(myMod->eV), INT32);
if (!n) {
return -1;
}
ts += n;
// dacs
n = sendData(file_des, myMod->dacs, sizeof(int) * (myMod->ndac), INT32);
if (!n) {
return -1;
}
ts += n;
// channels
#if defined(EIGERD) || defined(MYTHEN3D)
n = sendData(file_des, myMod->chanregs, sizeof(int) * (myMod->nchan),
INT32);
if (!n) {
return -1;
}
ts += n;
#endif
LOG(logDEBUG1, ("module of size %d sent register %x\n", ts, myMod->reg));
return ts;
}
int receiveModule(int file_des, sls_detector_module *myMod) {
enum TLogLevel level = logDEBUG1;
LOG(level, ("Receiving Module\n"));

View File

@ -155,15 +155,12 @@ void function_table() {
flist[F_WRITE_REGISTER] = &write_register;
flist[F_READ_REGISTER] = &read_register;
flist[F_SET_MODULE] = &set_module;
flist[F_GET_MODULE] = &get_module;
flist[F_SET_SETTINGS] = &set_settings;
flist[F_GET_THRESHOLD_ENERGY] = &get_threshold_energy;
flist[F_START_ACQUISITION] = &start_acquisition;
flist[F_STOP_ACQUISITION] = &stop_acquisition;
flist[F_START_READOUT] = &start_readout;
flist[F_GET_RUN_STATUS] = &get_run_status;
flist[F_START_AND_READ_ALL] = &start_and_read_all;
flist[F_READ_ALL] = &read_all;
flist[F_GET_NUM_FRAMES] = &get_num_frames;
flist[F_SET_NUM_FRAMES] = &set_num_frames;
flist[F_GET_NUM_TRIGGERS] = &get_num_triggers;
@ -201,7 +198,6 @@ void function_table() {
flist[F_SET_DYNAMIC_RANGE] = &set_dynamic_range;
flist[F_SET_ROI] = &set_roi;
flist[F_GET_ROI] = &get_roi;
flist[F_EXIT_SERVER] = &exit_server;
flist[F_LOCK_SERVER] = &lock_server;
flist[F_GET_LAST_CLIENT_IP] = &get_last_client_ip;
flist[F_SET_PORT] = &set_port;
@ -292,8 +288,6 @@ void function_table() {
flist[F_GET_PARALLEL_MODE] = &get_parallel_mode;
flist[F_SET_OVERFLOW_MODE] = &set_overflow_mode;
flist[F_GET_OVERFLOW_MODE] = &get_overflow_mode;
flist[F_SET_STOREINRAM_MODE] = &set_storeinram;
flist[F_GET_STOREINRAM_MODE] = &get_storeinram;
flist[F_SET_READOUT_MODE] = &set_readout_mode;
flist[F_GET_READOUT_MODE] = &get_readout_mode;
flist[F_SET_CLOCK_FREQUENCY] = &set_clock_frequency;
@ -1544,68 +1538,6 @@ int set_module(int file_des) {
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_module(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
sls_detector_module module;
int *myDac = NULL;
int *myChan = NULL;
module.dacs = NULL;
module.chanregs = NULL;
// allocate to send arguments
// allocate dacs
myDac = malloc(getNumberOfDACs() * sizeof(int));
// error
if (getNumberOfDACs() > 0 && myDac == NULL) {
ret = FAIL;
sprintf(mess, "Could not allocate dacs\n");
LOG(logERROR, (mess));
} else
module.dacs = myDac;
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(GOTTHARD2D)
functionNotImplemented();
#endif
#if defined(EIGERD) || defined(MYTHEN3D)
// allocate chans
if (ret == OK) {
myChan = malloc(getTotalNumberOfChannels() * sizeof(int));
if (getTotalNumberOfChannels() > 0 && myChan == NULL) {
ret = FAIL;
sprintf(mess, "Could not allocate chans\n");
LOG(logERROR, (mess));
} else
module.chanregs = myChan;
}
#endif
// get module
if (ret == OK) {
module.nchip = getNumberOfChips();
module.nchan = getTotalNumberOfChannels();
module.ndac = getNumberOfDACs();
// only get
LOG(logDEBUG1, ("Getting module\n"));
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(GOTTHARD2D)
getModule(&module);
#endif
LOG(logDEBUG1, ("Getting module. Settings:%d\n", module.reg));
}
Server_SendResult(file_des, INT32, NULL, 0);
// send module, 0 is to receive partially (without trimbits etc)
if (ret != FAIL) {
ret = sendModule(file_des, &module);
}
free(myChan);
free(myDac);
return ret;
}
int set_settings(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
@ -1808,27 +1740,6 @@ int stop_acquisition(int file_des) {
return Server_SendResult(file_des, INT32, NULL, 0);
}
int start_readout(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
LOG(logDEBUG1, ("Starting readout\n"));
#ifndef EIGERD
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
ret = startReadOut();
if (ret == FAIL) {
sprintf(mess, "Could not start readout\n");
LOG(logERROR, (mess));
}
LOG(logDEBUG1, ("Starting readout ret: %d\n", ret));
}
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_run_status(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
@ -2793,14 +2704,6 @@ int get_roi(int file_des) {
return ret;
}
int exit_server(int file_des) {
LOG(logINFORED, ("Closing Server\n"));
ret = OK;
memset(mess, 0, sizeof(mess));
Server_SendResult(file_des, INT32, NULL, 0);
return GOODBYE;
}
int lock_server(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
@ -5327,11 +5230,11 @@ int get_dest_udp_port(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
LOG(logDEBUG1, ("Getting destination porstore in ram moden"));
LOG(logDEBUG1, ("Getting destination port"));
// get only
retval = udpDetails.dstport;
LOG(logDEBUG, ("udp destination port retstore in ram model: %u\n", retval));
LOG(logDEBUG, ("udp destination port retval: %u\n", retval));
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
@ -5570,43 +5473,6 @@ int get_overflow_mode(int file_des) {
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
int set_storeinram(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int arg = 0;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
LOG(logINFO, ("Setting store in ram mode: %u\n", arg));
#ifndef EIGERD
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
setStoreInRamMode(arg);
}
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_storeinram(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
LOG(logDEBUG1, ("Getting store in ram mode\n"));
#ifndef EIGERD
functionNotImplemented();
#else
// get only
retval = getStoreInRamMode();
LOG(logDEBUG1, ("store in ram mode retval: %u\n", retval));
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
int set_readout_mode(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));

View File

@ -765,12 +765,6 @@ class Detector {
/** [Eiger] */
void setOverFlowMode(bool value, Positions pos = {});
/** [Eiger] */
Result<bool> getStoreInRamMode(Positions pos = {}) const;
/** [Eiger] */
void setStoreInRamMode(bool value, Positions pos = {});
/** [Eiger] */
Result<bool> getBottom(Positions pos = {}) const;
@ -1412,7 +1406,8 @@ class Detector {
Result<sls::IpAddr> getLastClientIP(Positions pos = {}) const;
/** Execute a command on the detector server console */
void executeCommand(const std::string &value, Positions pos = {});
Result<std::string> executeCommand(const std::string &value,
Positions pos = {});
/** [Jungfrau][Mythen3][CTB][Moench]
* [Gotthard2] only in continuous mode */

View File

@ -2545,8 +2545,8 @@ std::string CmdProxy::ExecuteCommand(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->executeCommand(args[0], {det_id});
os << "successful" << '\n';
auto t = det->executeCommand(args[0], {det_id});
os << OutString(t) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
}

View File

@ -766,7 +766,6 @@ class CmdProxy {
{"settingspath", &CmdProxy::settingspath},
{"parallel", &CmdProxy::parallel},
{"overflow", &CmdProxy::overflow},
{"storeinram", &CmdProxy::storeinram},
{"flippeddatax", &CmdProxy::flippeddatax},
{"trimen", &CmdProxy::TrimEnergies},
{"ratecorr", &CmdProxy::RateCorrection},
@ -1776,10 +1775,6 @@ class CmdProxy {
"[0, 1]\n\t[Eiger] Enable or disable show overflow flag in "
"32 bit mode.");
INTEGER_COMMAND(storeinram, getStoreInRamMode, setStoreInRamMode,
StringTo<int>,
"[0, 1]\n\t[Eiger] Enable or disable store in ram mode.");
INTEGER_COMMAND(
flippeddatax, getBottom, setBottom, StringTo<int>,
"[0, 1]\n\t[Eiger] Top or Bottom Half of Eiger module. 1 is bottom, 0 "

View File

@ -1064,14 +1064,6 @@ void Detector::setOverFlowMode(bool value, Positions pos) {
pimpl->Parallel(&Module::setOverFlowMode, pos, value);
}
Result<bool> Detector::getStoreInRamMode(Positions pos) const {
return pimpl->Parallel(&Module::getStoreInRamMode, pos);
}
void Detector::setStoreInRamMode(bool value, Positions pos) {
pimpl->Parallel(&Module::setStoreInRamMode, pos, value);
}
Result<bool> Detector::getBottom(Positions pos) const {
return pimpl->Parallel(&Module::getFlippedDataX, pos);
}
@ -1873,19 +1865,20 @@ void Detector::setStopPort(int value, Positions pos) {
}
Result<bool> Detector::getDetectorLock(Positions pos) const {
return pimpl->Parallel(&Module::lockServer, pos, -1);
return pimpl->Parallel(&Module::getLockDetector, pos);
}
void Detector::setDetectorLock(bool lock, Positions pos) {
pimpl->Parallel(&Module::lockServer, pos, static_cast<int>(lock));
pimpl->Parallel(&Module::setLockDetector, pos, lock);
}
Result<sls::IpAddr> Detector::getLastClientIP(Positions pos) const {
return pimpl->Parallel(&Module::getLastClientIP, pos);
}
void Detector::executeCommand(const std::string &value, Positions pos) {
pimpl->Parallel(&Module::execCommand, pos, value);
Result<std::string> Detector::executeCommand(const std::string &value,
Positions pos) {
return pimpl->Parallel(&Module::execCommand, pos, value);
}
Result<int64_t> Detector::getNumberOfFramesFromStart(Positions pos) const {

File diff suppressed because it is too large Load Diff

View File

@ -158,8 +158,10 @@ class Module : public virtual slsDetectorDefs {
void prepareAcquisition();
void startAcquisition();
void stopAcquisition();
void startAndReadAll();
runStatus getRunStatus() const;
runStatus getReceiverStatus() const;
int getReceiverProgress() const;
int64_t getFramesCaughtByReceiver() const;
std::vector<uint64_t> getNumMissingPackets() const;
uint64_t getStartingFrameNumber();
@ -299,8 +301,6 @@ class Module : public virtual slsDetectorDefs {
void setParallelMode(const bool enable);
bool getOverFlowMode();
void setOverFlowMode(const bool enable);
bool getStoreInRamMode();
void setStoreInRamMode(const bool enable);
bool getFlippedDataX();
void setFlippedDataX(bool value);
std::vector<int> getTrimEn();
@ -460,268 +460,51 @@ class Module : public virtual slsDetectorDefs {
* Moench *
* *
* ************************************************/
/**
* Set Detector offset in shared memory in dimension d
* @param det detector size
*/
int setControlPort(int port_number);
/**
* Returns the detector TCP control port \sa sharedSlsDetector
* @returns the detector TCP control port
*/
int getControlPort() const;
int setStopPort(int port_number);
/**
* Returns the detector TCP stop port \sa sharedSlsDetector
* @returns the detector TCP stop port
*/
int getStopPort() const;
/**
* Lock server for this client IP
* @param p 0 to unlock, 1 to lock (-1 gets)
* @returns true for locked or false for unlocked
*/
bool lockServer(int lock = -1);
/**
* Get last client IP saved on detector server
* @returns last client IP saved on detector server
*/
sls::IpAddr getLastClientIP();
/**
* Exit detector server
*/
void exitServer();
/**
* Executes a system command on the detector server
* e.g. mount an nfs disk, reboot and returns answer etc.
* @param cmd command to be executed
*/
void execCommand(const std::string &cmd);
/**
* Get detector specific commands to write into config file
* @returns vector of strings with commands
*/
std::vector<std::string> getConfigFileCommands();
/**
* Set threshold energy and settings (Eiger only)
* @param e_eV threshold in eV
* @param isettings ev. change settings
* @param tb 1 to include trimbits, 0 to exclude
*/
void setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings,
bool trimbits = true);
/**
* Start detector acquisition and read all data (Blocking until end of
* acquisition)
*/
void startAndReadAll();
/**
* Start readout (without exposure or interrupting exposure) (Eiger store in
* ram)
*/
void startReadOut();
/**
* Requests and receives all data from the detector (Eiger store in ram)
*/
void readAll();
/**
* Configures in detector the destination for UDP packets
*/
void configureMAC();
/** [Jungfrau][CTB][Moench][Mythen3]
* [Gotthard2] only in continuous mode */
int64_t getNumberOfFramesFromStart() const;
/** [Jungfrau][CTB][Moench][Mythen3] Get time from detector start
* [Gotthard2] only in continuous mode */
int64_t getActualTime() const;
/** [Jungfrau][CTB][Moench][Mythen3] Get timestamp at a frame start
* [Gotthard2] only in continuous mode */
int64_t getMeasurementTime() const;
/**
* Write in a register. For Advanced users
* @param addr address of register
* @param val value to write into register
* @returns value read after writing
*/
uint32_t writeRegister(uint32_t addr, uint32_t val);
/**
* Read from a register. For Advanced users
* @param addr address of register
* @returns value read from register
*/
uint32_t readRegister(uint32_t addr);
/**
* Set bit in a register. For Advanced users
* @param addr address of register
* @param n nth bit
* @returns value read from register
*/
uint32_t setBit(uint32_t addr, int n);
/**
* Clear bit in a register. For Advanced users
* @param addr address of register
* @param n nth bit
* @returns value read from register
*/
uint32_t clearBit(uint32_t addr, int n);
void test();
int getReceiverProgress() const;
/** update receiver stremaing ip from shm to receiver
* if empty, use rx_hostname ip
*/
void updateReceiverStreamingIP();
/** empty vector deletes entire additional json header */
std::map<std::string, std::string> getAdditionalJsonHeader();
void setAdditionalJsonHeader(
const std::map<std::string, std::string> &jsonHeader);
std::map<std::string, std::string> getAdditionalJsonHeader();
/**
* Sets the value for the additional json header parameter key if found,
* else append it. If value empty, then deletes parameter */
std::string getAdditionalJsonParameter(const std::string &key);
void setAdditionalJsonParameter(const std::string &key,
const std::string &value);
std::string getAdditionalJsonParameter(const std::string &key);
/** [Gotthard][Jungfrau][CTB][Moench] */
void executeFirmwareTest();
/** [Gotthard][Jungfrau][CTB][Moench] */
void executeBusTest();
/**
* Set ADC invert register (CTB, Moench, Jungfrau)
* @param value ADC invert value
* @param detPos -1 for all detectors in list or specific detector position
*/
void setADCInvert(uint32_t value);
/**
* Get ADC invert register (CTB, Moench, Jungfrau)
* @param detPos -1 for all detectors in list or specific detector position
* @returns ADC invert value
*/
uint32_t getADCInvert();
/**
* Write to ADC register (Gotthard, Jungfrau, ChipTestBoard). For expert
* users
* @param addr address of adc register
* @param val value
*/
void writeAdcRegister(uint32_t addr, uint32_t val);
/**
* Set storage cell that stores first acquisition of the series (Jungfrau)
* @param value storage cell index. Value can be 0 to 15. (-1 gets)
* @returns the storage cell that stores the first acquisition of the series
*/
/**
* [Jungfau][Ctb] Programs FPGA with raw file from pof file
* [Mythen3][Gotthard2] Programs FPGA with raw file from rbf file
* @param buffer programming file in memory
*/
/**************************************************
* *
* Advanced *
* *
* ************************************************/
void programFPGA(std::vector<char> buffer);
/** [Jungfau][Ctb] */
void programFPGAviaBlackfin(std::vector<char> buffer);
/** [Mythen3][Gotthard2] */
void programFPGAviaNios(std::vector<char> buffer);
/**
* Resets FPGA (Jungfrau)
*/
void resetFPGA();
/**
* Copies detector server from tftp and changes respawn server (Not Eiger)
* @param fname name of detector server binary
* @param hostname name of pc to tftp from
*/
void copyDetectorServer(const std::string &fname,
const std::string &hostname);
/**
* [Jungfrau][Ctb][Gotthard][Mythen3][Gotthard2]
* Reboot detector controller (blackfin/ powerpc)
*/
void rebootController();
uint32_t readRegister(uint32_t addr);
uint32_t writeRegister(uint32_t addr, uint32_t val);
uint32_t setBit(uint32_t addr, int n);
uint32_t clearBit(uint32_t addr, int n);
void executeFirmwareTest();
void executeBusTest();
void writeAdcRegister(uint32_t addr, uint32_t val);
uint32_t getADCInvert();
void setADCInvert(uint32_t value);
/**
* Get trimbit filename with path for settings and energy
*
*/
std::string getTrimbitFilename(detectorSettings settings, int e_eV);
/**
* Configure Module (Eiger)
* Called for loading trimbits and settings settings to the detector
* @param module module to be set - must contain correct module number and
* also channel and chip registers
* @param tb 1 to include trimbits, 0 to exclude (used for eiger)
* \sa ::sls_detector_module
*/
void setModule(sls_detector_module &module, bool trimbits = true);
/**
* Get module structure from detector (all detectors)
* @returns pointer to module structure (which has been created and must
* then be deleted)
*/
sls_detector_module getModule();
/**
* Update rate correction according to dynamic range (Eiger)
* If rate correction enabled and dr is 8 or 16, it will throw
* Otherwise update ratecorrection if enabled
*/
void updateRateCorrection();
/**
* Exits the receiver TCP server
*/
void exitReceiver();
/**
* Gets the current frame index of receiver
* @returns current frame index of receiver
*/
/**************************************************
* *
* Insignificant *
* *
* ************************************************/
int getControlPort() const;
int setControlPort(int port_number);
int getStopPort() const;
int setStopPort(int port_number);
bool getLockDetector();
void setLockDetector(bool lock);
sls::IpAddr getLastClientIP();
std::string execCommand(const std::string &cmd);
int64_t getNumberOfFramesFromStart() const;
int64_t getActualTime() const;
int64_t getMeasurementTime() const;
uint64_t getReceiverCurrentFrameIndex() const;
/**
* If data streaming in receiver is enabled,
* restream the stop dummy packet from receiver
* Used usually for Moench,
* in case it is lost in network due to high data rate
*/
void restreamStopFromReceiver();
private:
/**
* Send function parameters to detector (control server)
@ -747,14 +530,7 @@ class Module : public virtual slsDetectorDefs {
template <typename Ret, typename Arg>
Ret sendToDetector(int fnum, const Arg &args);
/**
* Send function parameters to detector (stop server)
* @param fnum function enum
* @param args argument pointer
* @param args_size size of argument
* @param retval return pointers
* @param retval_size size of return value
*/
/** Send function parameters to detector (stop server) */
void sendToDetectorStop(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size);
@ -790,14 +566,7 @@ class Module : public virtual slsDetectorDefs {
template <typename Ret, typename Arg>
Ret sendToDetectorStop(int fnum, const Arg &args);
/**
* Send function parameters to receiver
* @param fnum function enum
* @param args argument pointer
* @param args_size size of argument
* @param retval return pointers
* @param retval_size size of return value
*/
/** Send function parameters to receiver */
void sendToReceiver(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size);
@ -846,31 +615,16 @@ class Module : public virtual slsDetectorDefs {
void checkDetectorVersionCompatibility();
void checkReceiverVersionCompatibility();
/**
* Send a sls_detector_module structure over socket
* @param myMod module structure to send
* @returns number of bytes sent to the detector
*/
void restreamStopFromReceiver();
void setModule(sls_detector_module &module, bool trimbits = true);
int sendModule(sls_detector_module *myMod, sls::ClientSocket &client);
void updateReceiverStreamingIP();
/**
* Receive a sls_detector_module structure over socket
* @param myMod module structure to receive
* @returns number of bytes received from the detector
*/
int receiveModule(sls_detector_module *myMod, sls::ClientSocket &client);
/**
* Get MAC from the receiver using udpip and
* set up UDP connection in detector
*/
void setUDPConnection();
/*
* Template function to do linear interpolation between two points (Eiger
* only)
*/
void updateRateCorrection();
void setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings,
bool trimbits = true);
/** Template function to do linear interpolation between two points (Eiger
only) */
template <typename E, typename V>
V linearInterpolation(const E x, const E x1, const E x2, const V y1,
const V y2) {
@ -896,22 +650,13 @@ class Module : public virtual slsDetectorDefs {
const int energy, const int e1,
const int e2, bool trimbits = true);
/**
* reads a trim/settings file
* @param fname name of the file to be read
* @param myMod pointer to the module structure which has to be set. <BR>
* If it is NULL a new module structure will be created
* @param tb 1 to include trimbits, 0 to exclude (used for eiger)
* @returns the pointer to myMod or NULL if reading the file failed
*/
std::string getTrimbitFilename(detectorSettings settings, int e_eV);
sls_detector_module readSettingsFile(const std::string &fname,
bool trimbits = true);
void programFPGAviaBlackfin(std::vector<char> buffer);
void programFPGAviaNios(std::vector<char> buffer);
/** Module Id or position in the detectors list */
const int moduleId;
/** Shared Memory object */
mutable sls::SharedMemory<sharedSlsDetector> shm{0, 0};
};

View File

@ -109,7 +109,6 @@ void ClientInterface::startTCPServer() {
// clang-format off
int ClientInterface::functionTable(){
flist[F_EXEC_RECEIVER_COMMAND] = &ClientInterface::exec_command;
flist[F_EXIT_RECEIVER] = &ClientInterface::exit_server;
flist[F_LOCK_RECEIVER] = &ClientInterface::lock_receiver;
flist[F_GET_LAST_RECEIVER_CLIENT_IP] = &ClientInterface::get_last_client_ip;
flist[F_SET_RECEIVER_PORT] = &ClientInterface::set_port;
@ -291,12 +290,6 @@ int ClientInterface::exec_command(Interface &socket) {
return socket.sendResult(retval);
}
int ClientInterface::exit_server(Interface &socket) {
LOG(logINFO) << "Closing server";
socket.Send(OK);
return GOODBYE;
}
int ClientInterface::lock_receiver(Interface &socket) {
auto lock = socket.Receive<int>();
LOG(logDEBUG1) << "Locking Server to " << lock;

View File

@ -61,7 +61,6 @@ class ClientInterface : private virtual slsDetectorDefs {
void verifyIdle(sls::ServerInterface &socket);
int exec_command(sls::ServerInterface &socket);
int exit_server(sls::ServerInterface &socket);
int lock_receiver(sls::ServerInterface &socket);
int get_last_client_ip(sls::ServerInterface &socket);
int set_port(sls::ServerInterface &socket);

View File

@ -26,15 +26,12 @@ enum detFuncs {
F_WRITE_REGISTER,
F_READ_REGISTER,
F_SET_MODULE,
F_GET_MODULE,
F_SET_SETTINGS,
F_GET_THRESHOLD_ENERGY,
F_START_ACQUISITION,
F_STOP_ACQUISITION,
F_START_READOUT,
F_GET_RUN_STATUS,
F_START_AND_READ_ALL,
F_READ_ALL,
F_GET_NUM_FRAMES,
F_SET_NUM_FRAMES,
F_GET_NUM_TRIGGERS,
@ -70,7 +67,6 @@ enum detFuncs {
F_SET_DYNAMIC_RANGE,
F_SET_ROI,
F_GET_ROI,
F_EXIT_SERVER,
F_LOCK_SERVER,
F_GET_LAST_CLIENT_IP,
F_SET_PORT,
@ -161,8 +157,6 @@ enum detFuncs {
F_GET_PARALLEL_MODE,
F_SET_OVERFLOW_MODE,
F_GET_OVERFLOW_MODE,
F_SET_STOREINRAM_MODE,
F_GET_STOREINRAM_MODE,
F_SET_READOUT_MODE,
F_GET_READOUT_MODE,
F_SET_CLOCK_FREQUENCY,
@ -213,7 +207,6 @@ enum detFuncs {
(detector server should not compile anyway) */
F_EXEC_RECEIVER_COMMAND,
F_EXIT_RECEIVER,
F_LOCK_RECEIVER,
F_GET_LAST_RECEIVER_CLIENT_IP,
F_SET_RECEIVER_PORT,
@ -332,15 +325,12 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_WRITE_REGISTER: return "F_WRITE_REGISTER";
case F_READ_REGISTER: return "F_READ_REGISTER";
case F_SET_MODULE: return "F_SET_MODULE";
case F_GET_MODULE: return "F_GET_MODULE";
case F_SET_SETTINGS: return "F_SET_SETTINGS";
case F_GET_THRESHOLD_ENERGY: return "F_GET_THRESHOLD_ENERGY";
case F_START_ACQUISITION: return "F_START_ACQUISITION";
case F_STOP_ACQUISITION: return "F_STOP_ACQUISITION";
case F_START_READOUT: return "F_START_READOUT";
case F_GET_RUN_STATUS: return "F_GET_RUN_STATUS";
case F_START_AND_READ_ALL: return "F_START_AND_READ_ALL";
case F_READ_ALL: return "F_READ_ALL";
case F_GET_NUM_FRAMES: return "F_GET_NUM_FRAMES";
case F_SET_NUM_FRAMES: return "F_SET_NUM_FRAMES";
case F_GET_NUM_TRIGGERS: return "F_GET_NUM_TRIGGERS";
@ -376,7 +366,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_DYNAMIC_RANGE: return "F_SET_DYNAMIC_RANGE";
case F_SET_ROI: return "F_SET_ROI";
case F_GET_ROI: return "F_GET_ROI";
case F_EXIT_SERVER: return "F_EXIT_SERVER";
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";
@ -467,8 +456,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_GET_PARALLEL_MODE: return "F_GET_PARALLEL_MODE";
case F_SET_OVERFLOW_MODE: return "F_SET_OVERFLOW_MODE";
case F_GET_OVERFLOW_MODE: return "F_GET_OVERFLOW_MODE";
case F_SET_STOREINRAM_MODE: return "F_SET_STOREINRAM_MODE";
case F_GET_STOREINRAM_MODE: return "F_GET_STOREINRAM_MODE";
case F_SET_READOUT_MODE: return "F_SET_READOUT_MODE";
case F_GET_READOUT_MODE: return "F_GET_READOUT_MODE";
case F_SET_CLOCK_FREQUENCY: return "F_SET_CLOCK_FREQUENCY";
@ -518,7 +505,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
case F_EXEC_RECEIVER_COMMAND: return "F_EXEC_RECEIVER_COMMAND";
case F_EXIT_RECEIVER: return "F_EXIT_RECEIVER";
case F_LOCK_RECEIVER: return "F_LOCK_RECEIVER";
case F_GET_LAST_RECEIVER_CLIENT_IP: return "F_GET_LAST_RECEIVER_CLIENT_IP";
case F_SET_RECEIVER_PORT: return "F_SET_RECEIVER_PORT";