mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-04 11:50:05 +02:00
removed gotthard functions not used
This commit is contained in:
parent
11c1fb0e11
commit
28963e313b
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -32,7 +32,6 @@ int detectorFirstServer = 1;
|
|||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {0};
|
||||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||||
enum externalSignalFlag signalMode = 0;
|
enum externalSignalFlag signalMode = 0;
|
||||||
int digitalTestBit = 0;
|
|
||||||
|
|
||||||
// roi configuration
|
// roi configuration
|
||||||
int adcConfigured = -1;
|
int adcConfigured = -1;
|
||||||
@ -245,12 +244,7 @@ int detectorTest( enum digitalTestMode arg, int ival) {
|
|||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
switch(arg){
|
switch(arg){
|
||||||
case DIGITAL_BIT_TEST:
|
case IMAGE_TEST: return testImage(ival);
|
||||||
if (ival > -1) {
|
|
||||||
digitalTestBit = (ival == 0) ? 0 : 1;
|
|
||||||
FILE_LOG(logINFO, ("Digital Test bit set: %d\n", digitalTestBit));
|
|
||||||
}
|
|
||||||
return digitalTestBit;
|
|
||||||
case DETECTOR_FIRMWARE_TEST: return testFpga();
|
case DETECTOR_FIRMWARE_TEST: return testFpga();
|
||||||
case DETECTOR_BUS_TEST: return testBus();
|
case DETECTOR_BUS_TEST: return testBus();
|
||||||
default:
|
default:
|
||||||
@ -260,6 +254,19 @@ int detectorTest( enum digitalTestMode arg, int ival) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int testImage(int ival) {
|
||||||
|
uint32_t addr = MULTI_PURPOSE_REG;
|
||||||
|
if (ival >= 0) {
|
||||||
|
if (ival == 0) {
|
||||||
|
FILE_LOG(logINFO, ("Switching on Image Test\n"));
|
||||||
|
bus_w (addr, bus_r(addr) & ~DGTL_TST_MSK);
|
||||||
|
} else {
|
||||||
|
FILE_LOG(logINFO, ("Switching off Image Test\n"));
|
||||||
|
bus_w (addr, bus_r(addr) | DGTL_TST_MSK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ((bus_r(addr) & DGTL_TST_MSK) >> DGTL_TST_OFST);
|
||||||
|
}
|
||||||
|
|
||||||
/* Ids */
|
/* Ids */
|
||||||
|
|
||||||
@ -1351,13 +1358,6 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
|||||||
(long long unsigned int)destmac));
|
(long long unsigned int)destmac));
|
||||||
FILE_LOG(logINFO, ("\tDest. Port : %d (0x%08x)\n",udpport, udpport));
|
FILE_LOG(logINFO, ("\tDest. Port : %d (0x%08x)\n",udpport, udpport));
|
||||||
|
|
||||||
// set/ unset the digital test bit
|
|
||||||
if (digitalTestBit)
|
|
||||||
bus_w (addr, bus_r(addr) | DGTL_TST_MSK);
|
|
||||||
else
|
|
||||||
bus_w (addr, bus_r(addr) & ~DGTL_TST_MSK);
|
|
||||||
FILE_LOG(logDEBUG1, ("\tDigital Test Bit. MultiPurpose reg: 0x%x\n", bus_r(addr)));
|
|
||||||
|
|
||||||
//reset mac
|
//reset mac
|
||||||
bus_w (addr, bus_r(addr) | RST_MSK);
|
bus_w (addr, bus_r(addr) | RST_MSK);
|
||||||
FILE_LOG(logDEBUG1, ("\tReset Mac. MultiPurpose reg: 0x%x\n", bus_r(addr)));
|
FILE_LOG(logDEBUG1, ("\tReset Mac. MultiPurpose reg: 0x%x\n", bus_r(addr)));
|
||||||
@ -1518,107 +1518,6 @@ int getAdcConfigured(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* gotthard specific - loadimage, read/reset counter block */
|
|
||||||
|
|
||||||
void loadImage(enum imageType index, short int imageVals[]){
|
|
||||||
u_int32_t addr = DARK_IMAGE_REG;
|
|
||||||
if (index == GAIN_IMAGE)
|
|
||||||
addr = GAIN_IMAGE_REG;
|
|
||||||
int dataBytes = calculateDataBytes();
|
|
||||||
|
|
||||||
volatile u_int16_t *ptr = (u_int16_t*)(CSP0BASE + addr * 2);
|
|
||||||
memcpy((char*)ptr, (char*)imageVals, dataBytes);
|
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("Loaded %s image at 0x%p\n",
|
|
||||||
(index == GAIN_IMAGE) ? "Gain" : "Dark", (void*) ptr));
|
|
||||||
}
|
|
||||||
|
|
||||||
int readCounterBlock(int startACQ, short int counterVals[]){
|
|
||||||
FILE_LOG(logINFO, ("Reading Counter Block with start Acq :%d\n", startACQ));
|
|
||||||
|
|
||||||
// stop any current acquisition
|
|
||||||
if (runBusy()) {
|
|
||||||
if (stopStateMachine() == FAIL)
|
|
||||||
return FAIL;
|
|
||||||
// waiting for the last frame read to be done
|
|
||||||
while(runBusy())
|
|
||||||
usleep(500);
|
|
||||||
FILE_LOG(logDEBUG1, ("State machine stopped\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy memory
|
|
||||||
u_int32_t addr = COUNTER_MEMORY_REG;
|
|
||||||
volatile u_int16_t *ptr = (u_int16_t*)(CSP0BASE + addr * 2);
|
|
||||||
int dataBytes = calculateDataBytes();
|
|
||||||
memcpy((char*)counterVals, (char*)ptr, dataBytes);
|
|
||||||
|
|
||||||
// unreset counter
|
|
||||||
addr = MULTI_PURPOSE_REG;
|
|
||||||
bus_w(addr, (bus_r(addr) &~ RST_CNTR_MSK));
|
|
||||||
FILE_LOG(logDEBUG1, ("\tUnsetting reset Counter. Multi Purpose Reg: 0x%x\n", bus_r(addr)));
|
|
||||||
|
|
||||||
// start state machine
|
|
||||||
if (startACQ == 1){
|
|
||||||
startStateMachine();
|
|
||||||
if (runBusy()) {
|
|
||||||
FILE_LOG(logINFO, ("State machine RUNNING\n"));
|
|
||||||
} else {
|
|
||||||
FILE_LOG(logINFO, ("State machine IDLE\n"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int resetCounterBlock(int startACQ){
|
|
||||||
FILE_LOG(logINFO, ("Resetting Counter Block with start Acq :%d\n", startACQ));
|
|
||||||
|
|
||||||
// stop any current acquisition
|
|
||||||
if (runBusy()) {
|
|
||||||
if (stopStateMachine() == FAIL)
|
|
||||||
return FAIL;
|
|
||||||
// waiting for the last frame read to be done
|
|
||||||
while(runBusy())
|
|
||||||
usleep(500);
|
|
||||||
FILE_LOG(logDEBUG1, ("State machine stopped\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// reset counter
|
|
||||||
u_int32_t addr = MULTI_PURPOSE_REG;
|
|
||||||
bus_w(addr, (bus_r(addr) | RST_CNTR_MSK));
|
|
||||||
FILE_LOG(logDEBUG1, ("\tResetting Counter. Multi Purpose Reg: 0x%x\n", bus_r(addr)));
|
|
||||||
|
|
||||||
// copy memory
|
|
||||||
addr = COUNTER_MEMORY_REG;
|
|
||||||
volatile u_int16_t *ptr = (u_int16_t*)(CSP0BASE + addr * 2);
|
|
||||||
int dataBytes = calculateDataBytes();
|
|
||||||
char *counterVals = NULL;
|
|
||||||
counterVals = realloc(counterVals, dataBytes);
|
|
||||||
memcpy((char*)counterVals, (char*)ptr, dataBytes);
|
|
||||||
|
|
||||||
// unreset counter
|
|
||||||
addr = MULTI_PURPOSE_REG;
|
|
||||||
bus_w(addr, (bus_r(addr) &~ RST_CNTR_MSK));
|
|
||||||
FILE_LOG(logDEBUG1, ("\tUnsetting reset Counter. Multi Purpose Reg: 0x%x\n", bus_r(addr)));
|
|
||||||
|
|
||||||
// start state machine
|
|
||||||
if (startACQ == 1){
|
|
||||||
startStateMachine();
|
|
||||||
if (runBusy()) {
|
|
||||||
FILE_LOG(logINFO, ("State machine RUNNING\n"));
|
|
||||||
} else {
|
|
||||||
FILE_LOG(logINFO, ("State machine IDLE\n"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sizeof(counterVals) <= 0){
|
|
||||||
FILE_LOG(logERROR, ("\tSize of counterVals: %d\n", (int)sizeof(counterVals)));
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* aquisition */
|
/* aquisition */
|
||||||
|
|
||||||
int startStateMachine(){
|
int startStateMachine(){
|
||||||
|
Binary file not shown.
@ -27,6 +27,7 @@ int testBus();
|
|||||||
|
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
int detectorTest(enum digitalTestMode arg, int ival);
|
int detectorTest(enum digitalTestMode arg, int ival);
|
||||||
|
int testImage(int ival);
|
||||||
#elif defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
#elif defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||||
int detectorTest(enum digitalTestMode arg);
|
int detectorTest(enum digitalTestMode arg);
|
||||||
#endif
|
#endif
|
||||||
@ -301,14 +302,8 @@ void setPatternBitMask(uint64_t mask);
|
|||||||
uint64_t getPatternBitMask();
|
uint64_t getPatternBitMask();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// gotthard specific - image, pedestal
|
|
||||||
#ifdef GOTTHARDD
|
|
||||||
void loadImage(enum imageType index, short int imageVals[]);
|
|
||||||
int readCounterBlock(int startACQ, short int counterVals[]);
|
|
||||||
int resetCounterBlock(int startACQ);
|
|
||||||
|
|
||||||
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock, pll, flashing firmware
|
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock, pll, flashing firmware
|
||||||
#elif JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
void initReadoutConfiguration();
|
void initReadoutConfiguration();
|
||||||
int powerChip (int on);
|
int powerChip (int on);
|
||||||
int autoCompDisable(int on);
|
int autoCompDisable(int on);
|
||||||
|
@ -197,9 +197,6 @@ const char* getFunctionName(enum detFuncs func) {
|
|||||||
case F_SET_PORT: return "F_SET_PORT";
|
case F_SET_PORT: return "F_SET_PORT";
|
||||||
case F_UPDATE_CLIENT: return "F_UPDATE_CLIENT";
|
case F_UPDATE_CLIENT: return "F_UPDATE_CLIENT";
|
||||||
case F_CONFIGURE_MAC: return "F_CONFIGURE_MAC";
|
case F_CONFIGURE_MAC: return "F_CONFIGURE_MAC";
|
||||||
case F_LOAD_IMAGE: return "F_LOAD_IMAGE";
|
|
||||||
case F_READ_COUNTER_BLOCK: return "F_READ_COUNTER_BLOCK";
|
|
||||||
case F_RESET_COUNTER_BLOCK: return "F_RESET_COUNTER_BLOCK";
|
|
||||||
case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA";
|
case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA";
|
||||||
case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS";
|
case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS";
|
||||||
case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL";
|
case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL";
|
||||||
@ -288,9 +285,6 @@ void function_table() {
|
|||||||
flist[F_SET_PORT] = &set_port;
|
flist[F_SET_PORT] = &set_port;
|
||||||
flist[F_UPDATE_CLIENT] = &update_client;
|
flist[F_UPDATE_CLIENT] = &update_client;
|
||||||
flist[F_CONFIGURE_MAC] = &configure_mac;
|
flist[F_CONFIGURE_MAC] = &configure_mac;
|
||||||
flist[F_LOAD_IMAGE] = &load_image;
|
|
||||||
flist[F_READ_COUNTER_BLOCK] = &read_counter_block;
|
|
||||||
flist[F_RESET_COUNTER_BLOCK] = &reset_counter_block;
|
|
||||||
flist[F_ENABLE_TEN_GIGA] = &enable_ten_giga;
|
flist[F_ENABLE_TEN_GIGA] = &enable_ten_giga;
|
||||||
flist[F_SET_ALL_TRIMBITS] = &set_all_trimbits;
|
flist[F_SET_ALL_TRIMBITS] = &set_all_trimbits;
|
||||||
flist[F_SET_PATTERN_IO_CONTROL] = &set_pattern_io_control;
|
flist[F_SET_PATTERN_IO_CONTROL] = &set_pattern_io_control;
|
||||||
@ -619,7 +613,7 @@ int digital_test(int file_des) {
|
|||||||
case DETECTOR_FIRMWARE_TEST:
|
case DETECTOR_FIRMWARE_TEST:
|
||||||
case DETECTOR_BUS_TEST:
|
case DETECTOR_BUS_TEST:
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
case DIGITAL_BIT_TEST:
|
case IMAGE_TEST:
|
||||||
retval = detectorTest(mode, ival);
|
retval = detectorTest(mode, ival);
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
@ -2498,131 +2492,6 @@ int configure_mac(int file_des) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int load_image(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int args[2] = {-1, -1};
|
|
||||||
|
|
||||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
|
|
||||||
enum imageType index = args[0];
|
|
||||||
int numChannels = args[1];
|
|
||||||
short int imageVals[numChannels];
|
|
||||||
memset(imageVals, 0, numChannels * sizeof(short int));
|
|
||||||
if (numChannels > 0) {
|
|
||||||
if (receiveData(file_des, imageVals, numChannels * sizeof(short int), OTHER) < 0) {
|
|
||||||
return printSocketReadError();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FILE_LOG(logDEBUG1, ("Loading %s image (ind:%d)\n", (index == DARK_IMAGE) ? "dark" :
|
|
||||||
((index == GAIN_IMAGE) ? "gain" : "unknown"), index));
|
|
||||||
|
|
||||||
#ifndef GOTTHARDD
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
|
|
||||||
// set only
|
|
||||||
if (Server_VerifyLock() == OK) {
|
|
||||||
switch (index) {
|
|
||||||
case DARK_IMAGE :
|
|
||||||
case GAIN_IMAGE :
|
|
||||||
// size of image does not match expected size
|
|
||||||
if (numChannels != (calculateDataBytes()/sizeof(short int))) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess, "Could not load image. "
|
|
||||||
"Number of Channels do not match. Expected %d, got %d\n",
|
|
||||||
calculateDataBytes(), numChannels);
|
|
||||||
FILE_LOG(logERROR,(mess));
|
|
||||||
} else
|
|
||||||
loadImage(index, imageVals);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
modeNotImplemented("Image index", (int)index);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int read_counter_block(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int args[2] = {-1, -1};
|
|
||||||
|
|
||||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
int startACQ = args[0];
|
|
||||||
int numChannels = args[1];
|
|
||||||
short int retval[numChannels];
|
|
||||||
memset(retval, 0, numChannels * sizeof(short int));
|
|
||||||
FILE_LOG(logDEBUG1, ("Read counter block with start acq bit: %d\n", startACQ));
|
|
||||||
|
|
||||||
#ifndef GOTTHARDD
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
|
|
||||||
// only set
|
|
||||||
if (Server_VerifyLock() == OK) {
|
|
||||||
// size of image does not match expected size
|
|
||||||
if (numChannels != (calculateDataBytes()/sizeof(short int))) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess, "Could not load image. "
|
|
||||||
"Number of Channels do not match. Expected %d, got %d\n",
|
|
||||||
calculateDataBytes(), numChannels);
|
|
||||||
FILE_LOG(logERROR,(mess));
|
|
||||||
} else {
|
|
||||||
ret = readCounterBlock(startACQ, retval);
|
|
||||||
if (ret == FAIL) {
|
|
||||||
strcpy(mess, "Could not read counter block\n");
|
|
||||||
FILE_LOG(logERROR,(mess));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, OTHER, UPDATE, retval, numChannels * sizeof(short int));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int reset_counter_block(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int startACQ = -1;
|
|
||||||
|
|
||||||
if (receiveData(file_des, &startACQ, sizeof(startACQ), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
FILE_LOG(logDEBUG1, ("Reset counter block with start acq bit: %d\n", startACQ));
|
|
||||||
|
|
||||||
#ifndef GOTTHARDD
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// only set
|
|
||||||
if (Server_VerifyLock() == OK) {
|
|
||||||
ret = resetCounterBlock(startACQ);
|
|
||||||
if (ret == FAIL) {
|
|
||||||
strcpy(mess, "Could not reset counter block\n");
|
|
||||||
FILE_LOG(logERROR, (mess));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int enable_ten_giga(int file_des) {
|
int enable_ten_giga(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
|
@ -58,9 +58,6 @@ int set_port(int);
|
|||||||
int update_client(int);
|
int update_client(int);
|
||||||
int send_update(int);
|
int send_update(int);
|
||||||
int configure_mac(int);
|
int configure_mac(int);
|
||||||
int load_image(int);
|
|
||||||
int read_counter_block(int);
|
|
||||||
int reset_counter_block(int);
|
|
||||||
int calibrate_pedestal(int);
|
int calibrate_pedestal(int);
|
||||||
int enable_ten_giga(int);
|
int enable_ten_giga(int);
|
||||||
int set_all_trimbits(int);
|
int set_all_trimbits(int);
|
||||||
|
@ -778,10 +778,10 @@ class Detector {
|
|||||||
*/
|
*/
|
||||||
void setROI(defs::ROI value, int moduleId);
|
void setROI(defs::ROI value, int moduleId);
|
||||||
|
|
||||||
/** [Gotthard] TODO: check with jiaguo if he needs any of these functions */
|
/** [Gotthard] TODO: check with jiaguo if he needs any of these functions // TODO remove */
|
||||||
Result<ns> getExptimeLeft(Positions pos = {}) const;
|
Result<ns> getExptimeLeft(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Gotthard] */
|
/** [Gotthard] TODO remove */
|
||||||
Result<ns> getPeriodLeft(Positions pos = {}) const;
|
Result<ns> getPeriodLeft(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Gotthard] */
|
/** [Gotthard] */
|
||||||
@ -793,30 +793,10 @@ class Detector {
|
|||||||
Positions pos = {});
|
Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard] */
|
/** [Gotthard] */
|
||||||
void loadDarkImage(const std::string &fname, int module_id = -1);
|
Result<int> getImageTestMode(Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard] */
|
/** [Gotthard] If 1, adds channel intensity with precalculated values. Default is 0 */
|
||||||
void loadGainImage(const std::string &fname, int module_id = -1);
|
Result<int> setImageTestMode(const int value, Positions pos = {});
|
||||||
|
|
||||||
/**
|
|
||||||
* [Gotthard] subset modules not allowed
|
|
||||||
* @param startACQ if start acq after reading counter
|
|
||||||
*/
|
|
||||||
void getCounterMemoryBlock(const std::string &fname, bool startACQ,
|
|
||||||
Positions pos = {});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [Gotthard]
|
|
||||||
* @param startACQ if start acq after resetting counter
|
|
||||||
* TODO! does it make sense to call one detector?
|
|
||||||
*/
|
|
||||||
void resetCounterBlock(bool startACQ, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Gotthard] */
|
|
||||||
Result<int> getDigitalTestBit(Positions pos = {});
|
|
||||||
|
|
||||||
/** [Gotthard] */
|
|
||||||
Result<int> setDigitalTestBit(const int value, Positions pos = {});
|
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
|
@ -1229,39 +1229,14 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
int setFlowControl10G(int enable = -1, int detPos = -1); //
|
int setFlowControl10G(int enable = -1, int detPos = -1); //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a digital test (Gotthard)
|
* Execute a digital test (Gotthard, Jungfrau, CTB)
|
||||||
* @param mode testmode type
|
* @param mode testmode type
|
||||||
* @param value 1 to set or 0 to clear the digital test bit
|
* @param value 1 to set or 0 to clear the image test bit (Gotthard)
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns result of test
|
* @returns result of test
|
||||||
*/
|
*/
|
||||||
int digitalTest(digitalTestMode mode, int ival = -1, int detPos = -1);
|
int digitalTest(digitalTestMode mode, int ival = -1, int detPos = -1);
|
||||||
|
|
||||||
/**
|
|
||||||
* Load dark or gain image to detector (Gotthard)
|
|
||||||
* @param index image type
|
|
||||||
* @param fname file name from which to load image
|
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
|
||||||
*/
|
|
||||||
void loadImageToDetector(imageType index, const std::string &fname,
|
|
||||||
int detPos = -1); //
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes the counter memory block from the detector (Gotthard)
|
|
||||||
* @param fname file name to load data from
|
|
||||||
* @param startACQ is 1 to start acquisition after reading counter
|
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
|
||||||
*/
|
|
||||||
void writeCounterBlockFile(const std::string &fname, int startACQ = 0,
|
|
||||||
int detPos = -1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets counter in detector (Gotthard)
|
|
||||||
* @param startACQ is 1 to start acquisition after resetting counter
|
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
|
||||||
*/
|
|
||||||
void resetCounterBlock(int startACQ = 0, int detPos = -1); //
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get counter bit in detector (Eiger)
|
* Set/get counter bit in detector (Eiger)
|
||||||
* @param i is -1 to get, 0 to reset and any other value to set the counter
|
* @param i is -1 to get, 0 to reset and any other value to set the counter
|
||||||
|
@ -979,47 +979,13 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
int64_t getReceiverRealUDPSocketBufferSize() const;
|
int64_t getReceiverRealUDPSocketBufferSize() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a digital test (Gotthard, Mythen)
|
* Execute a digital test (Gotthard, Jungfrau, CTB)
|
||||||
* @param mode testmode type
|
* @param mode testmode type
|
||||||
* @param value 1 to set or 0 to clear the digital test bit
|
* @param value 1 to set or 0 to clear the digital test bit
|
||||||
* @returns result of test
|
* @returns result of test
|
||||||
*/
|
*/
|
||||||
int digitalTest(digitalTestMode mode, int ival = -1);
|
int digitalTest(digitalTestMode mode, int ival = -1);
|
||||||
|
|
||||||
/**
|
|
||||||
* Load dark or gain image to detector (Gotthard)
|
|
||||||
* @param index image type, 0 for dark image and 1 for gain image
|
|
||||||
* @param fname file name from which to load image
|
|
||||||
*/
|
|
||||||
void loadImageToDetector(imageType index, const std::string &fname);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called from loadImageToDetector to send the image to detector
|
|
||||||
* @param index image type, 0 for dark image and 1 for gain image
|
|
||||||
* @param imageVals image
|
|
||||||
*/
|
|
||||||
void sendImageToDetector(imageType index, int16_t imageVals[]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes the counter memory block from the detector (Gotthard)
|
|
||||||
* @param fname file name to load data from
|
|
||||||
* @param startACQ is 1 to start acquisition after reading counter
|
|
||||||
*/
|
|
||||||
void writeCounterBlockFile(const std::string &fname, int startACQ = 0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets counter memory block in detector (Gotthard)
|
|
||||||
* @param image counter memory block from detector
|
|
||||||
* @param startACQ 1 to start acquisition afterwards, else 0
|
|
||||||
*/
|
|
||||||
void getCounterBlock(int16_t image[], int startACQ = 0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets counter in detector
|
|
||||||
* @param startACQ is 1 to start acquisition after resetting counter
|
|
||||||
*/
|
|
||||||
void resetCounterBlock(int startACQ = 0);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get counter bit in detector (Gotthard)
|
* Set/get counter bit in detector (Gotthard)
|
||||||
* @param i is -1 to get, 0 to reset and any other value to set the counter
|
* @param i is -1 to get, 0 to reset and any other value to set the counter
|
||||||
|
@ -73,7 +73,6 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
static std::string helpSpeed(int action);
|
static std::string helpSpeed(int action);
|
||||||
static std::string helpAdvanced(int action);
|
static std::string helpAdvanced(int action);
|
||||||
static std::string helpConfiguration(int action);
|
static std::string helpConfiguration(int action);
|
||||||
static std::string helpImage(int action);
|
|
||||||
static std::string helpCounter(int action);
|
static std::string helpCounter(int action);
|
||||||
static std::string helpADC(int action);
|
static std::string helpADC(int action);
|
||||||
static std::string helpTempControl(int action);
|
static std::string helpTempControl(int action);
|
||||||
@ -134,7 +133,6 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
std::string cmdSpeed(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdSpeed(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdAdvanced(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdAdvanced(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdConfiguration(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdConfiguration(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdImage(int narg, const char * const args[], int action, int detPos = -1);
|
|
||||||
std::string cmdCounter(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdCounter(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdADC(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdADC(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdTempControl(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdTempControl(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
|
@ -1015,48 +1015,14 @@ void Detector::setExternalSignalFlags(defs::externalSignalFlag value,
|
|||||||
pimpl->Parallel(&slsDetector::setExternalSignalFlags, pos, value);
|
pimpl->Parallel(&slsDetector::setExternalSignalFlags, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::loadDarkImage(const std::string &fname, int module_id) {
|
Result<int> Detector::getImageTestMode(Positions pos) {
|
||||||
if (module_id == -1) {
|
|
||||||
pimpl->loadImageToDetector(defs::DARK_IMAGE, fname, -1);
|
|
||||||
}
|
|
||||||
pimpl->Parallel(&slsDetector::loadImageToDetector, {module_id}, defs::DARK_IMAGE,
|
|
||||||
fname);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::loadGainImage(const std::string &fname, int module_id) {
|
|
||||||
if (module_id == -1) {
|
|
||||||
pimpl->loadImageToDetector(defs::GAIN_IMAGE, fname, -1);
|
|
||||||
}
|
|
||||||
pimpl->Parallel(&slsDetector::loadImageToDetector, {module_id}, defs::GAIN_IMAGE,
|
|
||||||
fname);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::getCounterMemoryBlock(const std::string &fname, bool startACQ,
|
|
||||||
Positions pos) {
|
|
||||||
if (pos.empty() || (pos.size() == 1 && pos[0] == -1)) {
|
|
||||||
pimpl->writeCounterBlockFile(fname, static_cast<int>(startACQ), -1);
|
|
||||||
}
|
|
||||||
if (pos.size() > 1) {
|
|
||||||
throw RuntimeError(
|
|
||||||
"Cannot load get counter memory block on a subset of modules");
|
|
||||||
}
|
|
||||||
pimpl->Parallel(&slsDetector::writeCounterBlockFile, pos, fname,
|
|
||||||
static_cast<int>(startACQ));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::resetCounterBlock(bool startACQ, Positions pos) {
|
|
||||||
pimpl->Parallel(&slsDetector::resetCounterBlock, pos,
|
|
||||||
static_cast<int>(startACQ));
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<int> Detector::getDigitalTestBit(Positions pos) {
|
|
||||||
return pimpl->Parallel(&slsDetector::digitalTest, pos,
|
return pimpl->Parallel(&slsDetector::digitalTest, pos,
|
||||||
defs::DIGITAL_BIT_TEST, -1);
|
defs::IMAGE_TEST, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::setDigitalTestBit(int value, Positions pos) {
|
Result<int> Detector::setImageTestMode(int value, Positions pos) {
|
||||||
return pimpl->Parallel(&slsDetector::digitalTest, pos,
|
return pimpl->Parallel(&slsDetector::digitalTest, pos,
|
||||||
defs::DIGITAL_BIT_TEST, value);
|
defs::IMAGE_TEST, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1889,64 +1889,6 @@ int multiSlsDetector::digitalTest(digitalTestMode mode, int ival, int detPos) {
|
|||||||
return sls::minusOneIfDifferent(r);
|
return sls::minusOneIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void multiSlsDetector::loadImageToDetector(imageType index,
|
|
||||||
const std::string &fname,
|
|
||||||
int detPos) {
|
|
||||||
// single
|
|
||||||
if (detPos >= 0) {
|
|
||||||
detectors[detPos]->loadImageToDetector(index, fname);
|
|
||||||
}
|
|
||||||
|
|
||||||
// multi
|
|
||||||
|
|
||||||
// read image for all
|
|
||||||
int nch = getNumberOfChannels().x;
|
|
||||||
short int imageVals[nch];
|
|
||||||
if (readDataFile(fname, imageVals, nch) < nch * (int)sizeof(short int)) {
|
|
||||||
throw RuntimeError("Could not open file or not enough data in file to "
|
|
||||||
"load image to detector.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// send image to all
|
|
||||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
|
||||||
detectors[idet]->sendImageToDetector(index, imageVals + idet * detectors[idet]->getNumberOfChannels().x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void multiSlsDetector::writeCounterBlockFile(const std::string &fname,
|
|
||||||
int startACQ, int detPos) {
|
|
||||||
// single
|
|
||||||
if (detPos >= 0) {
|
|
||||||
detectors[detPos]->writeCounterBlockFile(fname, startACQ);
|
|
||||||
}
|
|
||||||
|
|
||||||
// multi
|
|
||||||
int nch = getNumberOfChannels().x;
|
|
||||||
short int imageVals[nch];
|
|
||||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
|
||||||
detectors[idet]->getCounterBlock(
|
|
||||||
imageVals + idet * detectors[idet]->getNumberOfChannels().x,
|
|
||||||
startACQ);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (writeDataFile(fname, nch, imageVals) < nch * (int)sizeof(short int)) {
|
|
||||||
throw RuntimeError(
|
|
||||||
"Could not open file to write or did not write enough data"
|
|
||||||
" in file to write counter block file from detector.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void multiSlsDetector::resetCounterBlock(int startACQ, int detPos) {
|
|
||||||
// single
|
|
||||||
if (detPos >= 0) {
|
|
||||||
detectors[detPos]->resetCounterBlock(startACQ);
|
|
||||||
}
|
|
||||||
|
|
||||||
// multi
|
|
||||||
parallelCall(&slsDetector::resetCounterBlock, startACQ);
|
|
||||||
}
|
|
||||||
|
|
||||||
int multiSlsDetector::setCounterBit(int i, int detPos) {
|
int multiSlsDetector::setCounterBit(int i, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
|
@ -2167,65 +2167,6 @@ int slsDetector::digitalTest(digitalTestMode mode, int ival) {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void slsDetector::loadImageToDetector(imageType index,
|
|
||||||
const std::string &fname) {
|
|
||||||
int nChan = getNumberOfChannels().x;
|
|
||||||
int16_t args[nChan];
|
|
||||||
FILE_LOG(logDEBUG1) << "Loading " << (index == 0u ? "Dark" : "Gain")
|
|
||||||
<< "image from file " << fname;
|
|
||||||
|
|
||||||
if (readDataFile(fname, args, nChan) != 0) {
|
|
||||||
sendImageToDetector(index, args);
|
|
||||||
} else {
|
|
||||||
throw RuntimeError(
|
|
||||||
"slsDetector::loadImageToDetector: Could not open file: " + fname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void slsDetector::sendImageToDetector(imageType index, int16_t imageVals[]) {
|
|
||||||
int fnum = F_LOAD_IMAGE;
|
|
||||||
int nChan = getNumberOfChannels().x;
|
|
||||||
int args[]{static_cast<int>(index), nChan};
|
|
||||||
FILE_LOG(logDEBUG1) << "Sending image to detector";
|
|
||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
|
||||||
client.Send(&fnum, sizeof(fnum));
|
|
||||||
client.Send(args, sizeof(args));
|
|
||||||
client.Send(imageVals, nChan * sizeof(int16_t));
|
|
||||||
int ret = FAIL;
|
|
||||||
client.Receive(&ret, sizeof(ret));
|
|
||||||
char mess[MAX_STR_LENGTH]{};
|
|
||||||
client.Receive(mess, MAX_STR_LENGTH);
|
|
||||||
throw DetectorError("Detector " + std::to_string(detId) +
|
|
||||||
" returned error: " + std::string(mess));
|
|
||||||
if (ret == FORCE_UPDATE) {
|
|
||||||
updateCachedDetectorVariables();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void slsDetector::writeCounterBlockFile(const std::string &fname,
|
|
||||||
int startACQ) {
|
|
||||||
int nChan = getNumberOfChannels().x;
|
|
||||||
int16_t retvals[nChan];
|
|
||||||
FILE_LOG(logDEBUG1) << "Reading Counter to " << fname
|
|
||||||
<< (startACQ != 0 ? " and Restarting Acquisition"
|
|
||||||
: "\n");
|
|
||||||
getCounterBlock(retvals, startACQ);
|
|
||||||
writeDataFile(fname, nChan, retvals);
|
|
||||||
}
|
|
||||||
|
|
||||||
void slsDetector::getCounterBlock(int16_t image[], int startACQ) {
|
|
||||||
int fnum = F_READ_COUNTER_BLOCK;
|
|
||||||
int nChan = getNumberOfChannels().x;
|
|
||||||
int args[] = {startACQ, nChan};
|
|
||||||
FILE_LOG(logDEBUG1) << "Reading Counter block with startacq: " << startACQ;
|
|
||||||
sendToDetector(fnum, args, sizeof(args), image, nChan * sizeof(int16_t));
|
|
||||||
}
|
|
||||||
|
|
||||||
void slsDetector::resetCounterBlock(int startACQ) {
|
|
||||||
FILE_LOG(logDEBUG1) << "Resetting Counter with startacq: " << startACQ;
|
|
||||||
sendToDetector(F_RESET_COUNTER_BLOCK, startACQ, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int slsDetector::setCounterBit(int cb) {
|
int slsDetector::setCounterBit(int cb) {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
FILE_LOG(logDEBUG1) << "Sending counter bit " << cb;
|
FILE_LOG(logDEBUG1) << "Sending counter bit " << cb;
|
||||||
|
@ -125,9 +125,9 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
/* digital test and debugging */
|
/* digital test and debugging */
|
||||||
|
|
||||||
/*! \page test
|
/*! \page test
|
||||||
- <b>digibittest:[i]</b> performs digital test of the module i. Returns 0 if succeeded, otherwise error mask. Gotthard only. Only put!
|
- <b>imagetest [i]</b> If 1, adds channel intensity with precalculated values. Default is 0. Gotthard only.
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "digibittest";
|
descrToFuncMap[i].m_pFuncName = "imagetest";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdDigiTest;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdDigiTest;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
@ -213,20 +213,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdData;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdData;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page acquisition
|
|
||||||
- <b>readctr </b> Reads the counters from the detector memory (analog detector returning values translated into number of photons - only GOTTHARD). Cannot put.
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "readctr";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdCounter;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page acquisition
|
|
||||||
- <b>resetctr i </b> Resets counter in detector, restarts acquisition if i=1(analog detector returning values translated into number of photons - only GOTTHARD). Cannot put.
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "resetctr";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdCounter;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page acquisition
|
/*! \page acquisition
|
||||||
- <b>resmat i </b> sets/resets counter bit in detector.gets the counter bit in Eiger
|
- <b>resmat i </b> sets/resets counter bit in detector.gets the counter bit in Eiger
|
||||||
*/
|
*/
|
||||||
@ -856,19 +842,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
// descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdThreaded;
|
// descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdThreaded;
|
||||||
// ++i;
|
// ++i;
|
||||||
|
|
||||||
/*! \page data
|
|
||||||
- <b>darkimage fn</b> Loads the dark image to the detector from file fn (pedestal image). Cannot get. For Gotthard only.
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "darkimage";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdImage;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page data
|
|
||||||
- <b>gainimage fn</b> Loads the gain image to the detector from file fn (gain map for translation into number of photons of an analog detector). Cannot get. For Gotthard only.
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "gainimage";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdImage;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page settings Detector settings commands
|
/*! \page settings Detector settings commands
|
||||||
Commands to setup the settings of the detector
|
Commands to setup the settings of the detector
|
||||||
@ -2733,36 +2706,6 @@ std::string slsDetectorCommand::helpThreaded(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdImage(int narg, const char * const args[], int action, int detPos) {
|
|
||||||
std::string sval;
|
|
||||||
if (action == HELP_ACTION)
|
|
||||||
return helpImage(HELP_ACTION);
|
|
||||||
else if (action == GET_ACTION)
|
|
||||||
return std::string("Cannot get");
|
|
||||||
|
|
||||||
sval = std::string(args[1]);
|
|
||||||
|
|
||||||
if (std::string(args[0]) == std::string("darkimage"))
|
|
||||||
myDet->loadImageToDetector(DARK_IMAGE, sval, detPos);
|
|
||||||
else if (std::string(args[0]) == std::string("gainimage"))
|
|
||||||
myDet->loadImageToDetector(GAIN_IMAGE, sval, detPos);
|
|
||||||
|
|
||||||
return std::string("Image loaded succesfully");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string slsDetectorCommand::helpImage(int action) {
|
|
||||||
std::ostringstream os;
|
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
|
||||||
os << "darkimage f \t loads the image to detector from file f" << std::endl;
|
|
||||||
os << "gainimage f \t loads the image to detector from file f" << std::endl;
|
|
||||||
}
|
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
|
||||||
os << "darkimage \t Cannot get" << std::endl;
|
|
||||||
os << "gainimage \t Cannot get" << std::endl;
|
|
||||||
}
|
|
||||||
return os.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdCounter(int narg, const char * const args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdCounter(int narg, const char * const args[], int action, int detPos) {
|
||||||
int ival;
|
int ival;
|
||||||
char answer[100];
|
char answer[100];
|
||||||
@ -2773,27 +2716,7 @@ std::string slsDetectorCommand::cmdCounter(int narg, const char * const args[],
|
|||||||
else if (action == PUT_ACTION)
|
else if (action == PUT_ACTION)
|
||||||
ival = atoi(args[1]);
|
ival = atoi(args[1]);
|
||||||
|
|
||||||
|
if (std::string(args[0]) == std::string("resmat")) {
|
||||||
if (std::string(args[0]) == std::string("readctr")) {
|
|
||||||
if (action == PUT_ACTION)
|
|
||||||
return std::string("Cannot put");
|
|
||||||
else {
|
|
||||||
if (narg < 3)
|
|
||||||
return std::string("should specify I/O file");
|
|
||||||
sval = std::string(args[2]);
|
|
||||||
myDet->writeCounterBlockFile(sval, ival, detPos);
|
|
||||||
return std::string("Counter read succesfully");
|
|
||||||
}
|
|
||||||
} else if (std::string(args[0]) == std::string("resetctr")) {
|
|
||||||
if (action == GET_ACTION)
|
|
||||||
return std::string("Cannot get");
|
|
||||||
else {
|
|
||||||
myDet->resetCounterBlock(ival, detPos);
|
|
||||||
return std::string("successful");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (std::string(args[0]) == std::string("resmat")) {
|
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (!sscanf(args[1], "%d", &ival))
|
if (!sscanf(args[1], "%d", &ival))
|
||||||
return std::string("Could not scan resmat input ") + std::string(args[1]);
|
return std::string("Could not scan resmat input ") + std::string(args[1]);
|
||||||
@ -2814,13 +2737,9 @@ std::string slsDetectorCommand::helpCounter(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << std::endl;
|
os << std::endl;
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||||
os << "readctr \t Cannot put" << std::endl;
|
|
||||||
os << "resetctr i \t resets counter in detector, restarts acquisition if i=1" << std::endl;
|
|
||||||
os << "resmat i \t sets/resets counter bit in detector" << std::endl;
|
os << "resmat i \t sets/resets counter bit in detector" << std::endl;
|
||||||
}
|
}
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||||
os << "readctr i fname\t reads counter in detector to file fname, restarts acquisition if i=1" << std::endl;
|
|
||||||
os << "resetctr \t Cannot get" << std::endl;
|
|
||||||
os << "resmat i \t gets the counter bit in detector" << std::endl;
|
os << "resmat i \t gets the counter bit in detector" << std::endl;
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
@ -3606,18 +3525,17 @@ std::string slsDetectorCommand::cmdDigiTest(int narg, const char * const args[],
|
|||||||
return std::string(answer);
|
return std::string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (cmd == "digibittest") {
|
else if (cmd == "imagetest") {
|
||||||
if (action == GET_ACTION)
|
if (action == PUT_ACTION) {
|
||||||
return std::string("cannot get ") + cmd;
|
int ival = -1;
|
||||||
int ival = -1;
|
if (!sscanf(args[1], "%d", &ival)) {
|
||||||
if (sscanf(args[1], "%d", &ival)) {
|
return std::string("could not scan parameter for imagetest\n");
|
||||||
if ((ival == 0) || (ival == 1)) {
|
}
|
||||||
sprintf(answer, "%d", myDet->digitalTest(DIGITAL_BIT_TEST, ival, detPos));
|
ival = (ival == 0) ? 0 : 1;
|
||||||
return std::string(answer);
|
myDet->digitalTest(IMAGE_TEST, ival, detPos);
|
||||||
} else
|
}
|
||||||
return std::string("Use only 0 or 1 to set/clear digital test bit\n");
|
|
||||||
} else
|
return std::to_string(myDet->digitalTest(IMAGE_TEST, -1, detPos));
|
||||||
return std::string("undefined number");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::string("unknown test mode ") + cmd;
|
return std::string("unknown test mode ") + cmd;
|
||||||
@ -3627,7 +3545,12 @@ std::string slsDetectorCommand::helpDigiTest(int action) {
|
|||||||
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||||
os << "digibittest:i \t performs digital test of the module i. Returns 0 if succeeded, otherwise error mask.Gotthard only." << std::endl;
|
os << "imagetest i \t If 1, adds channel intensity with precalculated values. Default is 0. Gotthard only." << std::endl;
|
||||||
|
os << "bustest \t performs test of the bus interface between FPGA and embedded Linux system. Can last up to a few minutes. Jungfrau only." << std::endl;
|
||||||
|
os << "firmwaretest \t performs the firmware test. Jungfrau only." << std::endl;
|
||||||
|
}
|
||||||
|
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||||
|
os << "imagetest i \t If 1, adds channel intensity with precalculated values. Default is 0. Gotthard only." << std::endl;
|
||||||
os << "bustest \t performs test of the bus interface between FPGA and embedded Linux system. Can last up to a few minutes. Jungfrau only." << std::endl;
|
os << "bustest \t performs test of the bus interface between FPGA and embedded Linux system. Can last up to a few minutes. Jungfrau only." << std::endl;
|
||||||
os << "firmwaretest \t performs the firmware test. Jungfrau only." << std::endl;
|
os << "firmwaretest \t performs the firmware test. Jungfrau only." << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ format
|
|||||||
enum digitalTestMode {
|
enum digitalTestMode {
|
||||||
DETECTOR_FIRMWARE_TEST, /**< test detector system firmware */
|
DETECTOR_FIRMWARE_TEST, /**< test detector system firmware */
|
||||||
DETECTOR_BUS_TEST, /**< test detector system CPU-FPGA bus */
|
DETECTOR_BUS_TEST, /**< test detector system CPU-FPGA bus */
|
||||||
DIGITAL_BIT_TEST /**< gotthard digital bit test */
|
IMAGE_TEST /**< gotthard digital bit test */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -542,11 +542,6 @@ format
|
|||||||
IS_SLAVE /**< is slave */
|
IS_SLAVE /**< is slave */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum imageType {
|
|
||||||
DARK_IMAGE, /**< dark image */
|
|
||||||
GAIN_IMAGE /**< gain image */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* frame mode for processor
|
* frame mode for processor
|
||||||
*/
|
*/
|
||||||
|
@ -42,10 +42,7 @@ enum detFuncs{
|
|||||||
F_GET_LAST_CLIENT_IP, /**< returns the IP of the client last connected to the detector */
|
F_GET_LAST_CLIENT_IP, /**< returns the IP of the client last connected to the detector */
|
||||||
F_SET_PORT, /**< Changes communication port of the server */
|
F_SET_PORT, /**< Changes communication port of the server */
|
||||||
F_UPDATE_CLIENT, /**< Returns all the important parameters to update the shared memory of the client */
|
F_UPDATE_CLIENT, /**< Returns all the important parameters to update the shared memory of the client */
|
||||||
F_CONFIGURE_MAC, /**< Configures MAC for Gotthard readout */
|
F_CONFIGURE_MAC, /**< Configures MAC */
|
||||||
F_LOAD_IMAGE, /**< Loads Dark/Gain image to the Gotthard detector */
|
|
||||||
F_READ_COUNTER_BLOCK, /**< reads the counter block memory for gotthard */
|
|
||||||
F_RESET_COUNTER_BLOCK, /**< resets the counter block memory for gotthard */
|
|
||||||
F_ENABLE_TEN_GIGA, /**< enable 10Gbe */
|
F_ENABLE_TEN_GIGA, /**< enable 10Gbe */
|
||||||
F_SET_ALL_TRIMBITS, /** < set all trimbits to this value */
|
F_SET_ALL_TRIMBITS, /** < set all trimbits to this value */
|
||||||
F_SET_PATTERN_IO_CONTROL, /** < set pattern i/o control */
|
F_SET_PATTERN_IO_CONTROL, /** < set pattern i/o control */
|
||||||
@ -194,9 +191,6 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_SET_PORT: return "F_SET_PORT";
|
case F_SET_PORT: return "F_SET_PORT";
|
||||||
case F_UPDATE_CLIENT: return "F_UPDATE_CLIENT";
|
case F_UPDATE_CLIENT: return "F_UPDATE_CLIENT";
|
||||||
case F_CONFIGURE_MAC: return "F_CONFIGURE_MAC";
|
case F_CONFIGURE_MAC: return "F_CONFIGURE_MAC";
|
||||||
case F_LOAD_IMAGE: return "F_LOAD_IMAGE";
|
|
||||||
case F_READ_COUNTER_BLOCK: return "F_READ_COUNTER_BLOCK";
|
|
||||||
case F_RESET_COUNTER_BLOCK: return "F_RESET_COUNTER_BLOCK";
|
|
||||||
case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA";
|
case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA";
|
||||||
case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS";
|
case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS";
|
||||||
case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL";
|
case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL";
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
#define APILIB 0x190723
|
#define APILIB 0x190723
|
||||||
#define APIRECEIVER 0x190722
|
#define APIRECEIVER 0x190722
|
||||||
#define APIGUI 0x190723
|
#define APIGUI 0x190723
|
||||||
#define APICTB 0x190820
|
|
||||||
#define APIGOTTHARD 0x190820
|
|
||||||
#define APIJUNGFRAU 0x190820
|
|
||||||
#define APIMOENCH 0x190820
|
#define APIMOENCH 0x190820
|
||||||
|
#define APIGOTTHARD 0x190820
|
||||||
|
#define APICTB 0x190820
|
||||||
|
#define APIJUNGFRAU 0x190820
|
||||||
#define APIEIGER 0x190820
|
#define APIEIGER 0x190820
|
||||||
|
Loading…
x
Reference in New Issue
Block a user