Readoutflags (#61)

* WIP

* eiger binary back wih versioning

* fixed readout flag in ctbgui, added speedLevel enum

* ctbgui: fixed a print out error

* ctb readout bug fix

* WIP

* WIP

* WIP
This commit is contained in:
Dhanya Thattil 2019-09-02 19:27:27 +02:00 committed by GitHub
parent 221bb65c0e
commit 5bcde789ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 819 additions and 684 deletions

View File

@ -766,7 +766,7 @@ void ctbAcquisition::canvasClicked() {
void ctbAcquisition::setCanvas(TCanvas* c) {
myCanvas=c;
myCanvas->cd();
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)0x%p)->canvasClicked()",this));
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)%p)->canvasClicked()",this));
// myCanvas->AddExec("ex","canvasClicked()");
}
void ctbAcquisition::dataCallback(detectorData *data, long unsigned int index, unsigned int dum, void* pArgs) {
@ -1503,7 +1503,7 @@ void ctbAcquisition::update() {
} CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::update")
try {
roMode = myDet->getReadoutMode().tsquash("Different values");
roMode = static_cast<int>(myDet->getReadoutMode().tsquash("Different values"));
setReadoutMode(roMode);
} CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::update")
@ -1615,7 +1615,7 @@ void ctbAcquisition::toggleAcquisition() {
} CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::toggleAcquisition")
try {
roMode = myDet->getReadoutMode().tsquash("Different values");
roMode = static_cast<int>(myDet->getReadoutMode().tsquash("Different values"));
setReadoutMode(roMode);
} CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::toggleAcquisition")
@ -1798,11 +1798,11 @@ void ctbAcquisition::setDigitalSamples(int n) {
void ctbAcquisition::setReadoutMode(int f) {
roMode=f;
slsDetectorDefs::readOutFlags flags=(slsDetectorDefs::readOutFlags)f;
if (flags&slsDetectorDefs::DIGITAL_ONLY) {
slsDetectorDefs::readoutMode flag=(slsDetectorDefs::readoutMode)f;
if (flag == slsDetectorDefs::DIGITAL_ONLY) {
nAnalogSamples=0;
adclist.clear();
} else if (flags&slsDetectorDefs::ANALOG_AND_DIGITAL) {
} else if (flag ==slsDetectorDefs::ANALOG_AND_DIGITAL) {
;
}
else {

View File

@ -1011,19 +1011,19 @@ void ctbPattern::setDigitalSamples() {
void ctbPattern::setReadoutMode(Bool_t) {
try {
int flags = 0;
slsDetectorDefs::readoutMode flag = slsDetectorDefs::ANALOG_ONLY;
if (cbAnalog->IsOn() && cbDigital->IsOn())
flags=2;
flag=slsDetectorDefs::ANALOG_AND_DIGITAL;
else if (~cbAnalog->IsOn() && cbDigital->IsOn())
flags=1;
flag=slsDetectorDefs::DIGITAL_ONLY;
else if (cbAnalog->IsOn() && ~cbDigital->IsOn())
flags=0;
flag=slsDetectorDefs::ANALOG_ONLY;
else {
throw runtime_error("unkown readout flag");
}
myDet->setReadoutMode(flags);
cout << "Set readout flags: " << flags << endl;
} CATCH_DISPLAY ("Could not set readout flags", "ctbPattern::setReadoutMode")
myDet->setReadoutMode(flag);
cout << "Set readout flag: " << flag << endl;
} CATCH_DISPLAY ("Could not set readout flag", "ctbPattern::setReadoutMode")
getReadoutMode();
}
@ -1037,17 +1037,17 @@ int ctbPattern::getReadoutMode() {
try{
auto retval = myDet->getReadoutMode().tsquash("Different values");
switch(retval) {
case 2:
case slsDetectorDefs::ANALOG_AND_DIGITAL:
cout << "analog and digital" << endl;
cbAnalog->SetOn(kTRUE);
cbDigital->SetOn(kTRUE);
break;
case 1:
case slsDetectorDefs::DIGITAL_ONLY:
cout << "digital only" << endl;
cbAnalog->SetOn(kFALSE);
cbDigital->SetOn(kTRUE);
break;
case 0:
case slsDetectorDefs::ANALOG_ONLY:
cout << "analog only" << endl;
cbAnalog->SetOn(kTRUE);
cbDigital->SetOn(kFALSE);
@ -1055,7 +1055,7 @@ int ctbPattern::getReadoutMode() {
default:
throw("unknown readout flag");
}
Emit("readoutModeChanged(int)",retval);
Emit("readoutModeChanged(int)",static_cast<int>(retval));
return retval;
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")

View File

@ -41,13 +41,6 @@ public:
sls::Detector *det;
// Button group for radiobuttons for rate
QButtonGroup *btnGroupRate;
// enum for the Eiger clock divider
enum {
FULLSPEED,
HALFSPEED,
QUARTERSPEED,
NUMBEROFSPEEDS
};
// enum for the Eiger Parallel flag
enum {
PARALLEL,

View File

@ -283,16 +283,8 @@ void qTabDataOutput::GetSpeed() {
FILE_LOG(logDEBUG) << "Getting Speed";
disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
try {
int retval = det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
switch(retval) {
case FULLSPEED:
case HALFSPEED:
case QUARTERSPEED:
comboEigerClkDivider->setCurrentIndex(retval);
break;
default:
throw sls::RuntimeError(std::string("Unknown speed: ") + std::to_string(retval));
}
auto retval = det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
comboEigerClkDivider->setCurrentIndex(static_cast<int>(retval));
} CATCH_DISPLAY ("Could not get speed.", "qTabDataOutput::GetSpeed")
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
}
@ -300,7 +292,7 @@ void qTabDataOutput::GetSpeed() {
void qTabDataOutput::SetSpeed(int speed) {
FILE_LOG(logINFO) << "Setting Speed to " << comboEigerClkDivider->currentText().toAscii().data();;
try {
det->setSpeed(speed);
det->setSpeed(static_cast<slsDetectorDefs::speedLevel>(speed));
} CATCH_HANDLE ("Could not set speed.", "qTabDataOutput::SetSpeed", this, &qTabDataOutput::GetSpeed)
}
@ -314,7 +306,7 @@ void qTabDataOutput::GetFlags() {
comboEigerParallelFlag->setCurrentIndex(PARALLEL);
else
comboEigerParallelFlag->setCurrentIndex(NONPARALLEL);
} CATCH_DISPLAY ("Could not get speed.", "qTabDataOutput::GetSpeed")
} CATCH_DISPLAY ("Could not get flags.", "qTabDataOutput::GetFlags")
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
}

View File

@ -563,7 +563,7 @@ void setupDetector() {
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
setTimer(DELAY_AFTER_TRIGGER, DEFAULT_DELAY);
setTiming(DEFAULT_TIMING_MODE);
setReadOutFlags(NORMAL_READOUT);
setReadoutMode(ANALOG_ONLY);
// enable all ADC channels
setADCEnableMask(BIT_32_MSK);
@ -814,61 +814,51 @@ int getSpeed(enum speedVariable ind, int mode) {
}
}
enum readOutFlags setReadOutFlags(enum readOutFlags val) {
enum readOutFlags retval = GET_READOUT_FLAGS;
int setReadoutMode(enum readoutMode mode) {
uint32_t addr = CONFIG_REG;
// set
if (val != GET_READOUT_FLAGS) {
switch(val) {
case NORMAL_READOUT:
FILE_LOG(logINFO, ("Setting Normal Readout\n"));
bus_w(addr, bus_r(addr) & (~CONFIG_DSBL_ANLG_OTPT_MSK) & (~CONFIG_ENBLE_DGTL_OTPT_MSK));
break;
case DIGITAL_ONLY:
FILE_LOG(logINFO, ("Setting Digital Only Readout\n"));
bus_w(addr, bus_r(addr) | CONFIG_DSBL_ANLG_OTPT_MSK | CONFIG_ENBLE_DGTL_OTPT_MSK);
break;
case ANALOG_AND_DIGITAL:
FILE_LOG(logINFO, ("Setting Analog & Digital Readout\n"));
bus_w(addr, (bus_r(addr) & (~CONFIG_DSBL_ANLG_OTPT_MSK)) | CONFIG_ENBLE_DGTL_OTPT_MSK);
break;
default:
FILE_LOG(logERROR, ("Cannot set unknown readout flag. 0x%x\n", val));
return retval;
}
switch(mode) {
case ANALOG_ONLY:
FILE_LOG(logINFO, ("Setting Analog Only Readout\n"));
bus_w(addr, bus_r(addr) & (~CONFIG_DSBL_ANLG_OTPT_MSK) & (~CONFIG_ENBLE_DGTL_OTPT_MSK));
break;
case DIGITAL_ONLY:
FILE_LOG(logINFO, ("Setting Digital Only Readout\n"));
bus_w(addr, bus_r(addr) | CONFIG_DSBL_ANLG_OTPT_MSK | CONFIG_ENBLE_DGTL_OTPT_MSK);
break;
case ANALOG_AND_DIGITAL:
FILE_LOG(logINFO, ("Setting Analog & Digital Readout\n"));
bus_w(addr, (bus_r(addr) & (~CONFIG_DSBL_ANLG_OTPT_MSK)) | CONFIG_ENBLE_DGTL_OTPT_MSK);
break;
default:
FILE_LOG(logERROR, ("Cannot set unknown readout flag. 0x%x\n", mode));
return FAIL;
}
// get
uint32_t regval = bus_r(addr);
FILE_LOG(logDEBUG1, ("Config Reg: 0x%08x\n", regval));
// this bit reads analog disable, so inverse
analogEnable = (((regval & CONFIG_DSBL_ANLG_OTPT_MSK) >> CONFIG_DSBL_ANLG_OTPT_OFST) ? 0 : 1);
digitalEnable = ((regval & CONFIG_ENBLE_DGTL_OTPT_MSK) >> CONFIG_ENBLE_DGTL_OTPT_OFST);
if (analogEnable && digitalEnable) {
retval = ANALOG_AND_DIGITAL;
FILE_LOG(logDEBUG1, ("Getting readout: Analog & Digital 0x%x\n", retval));
} else if (analogEnable && !digitalEnable) {
retval = NORMAL_READOUT;
FILE_LOG(logDEBUG1, ("Getting readout: Normal 0x%x\n", retval));
} else if (!analogEnable && digitalEnable) {
retval = DIGITAL_ONLY;
FILE_LOG(logDEBUG1, ("Getting readout: Digital Only 0x%x\n", retval));
} else {
FILE_LOG(logERROR, ("Read unknown readout (Both digital and analog are disabled). "
"Config reg: 0x%x\n", regval));
return retval;
}
// update databytes and allocate ram
if (allocateRAM() == FAIL) {
return -2;
return FAIL;
}
return retval;
return OK;
}
int getReadoutMode() {
if (analogEnable && digitalEnable) {
FILE_LOG(logDEBUG1, ("Getting readout: Analog & Digita\n"));
return ANALOG_AND_DIGITAL;
} else if (analogEnable && !digitalEnable) {
FILE_LOG(logDEBUG1, ("Getting readout: Analog Only\n"));
return ANALOG_ONLY;
} else if (!analogEnable && digitalEnable) {
FILE_LOG(logDEBUG1, ("Getting readout: Digital Only\n"));
return DIGITAL_ONLY;
} else {
FILE_LOG(logERROR, ("Read unknown readout (Both digital and analog are disabled)\n"));
return -1;
}
}
/* parameters - timer */
@ -1520,6 +1510,7 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
FILE_LOG(logINFOBLUE, ("Configuring MAC\n"));
// 1 giga udp
if (!enableTenGigabitEthernet(-1)) {
FILE_LOG(logINFOBLUE, ("Configuring 1G MAC\n"));
// if it was in 10G mode, it was not allocating RAM
if (allocateRAM() == FAIL)
return -1;
@ -1535,67 +1526,67 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
}
// 10 G
else {
uint32_t sourceport = DEFAULT_TX_UDP_PORT;
FILE_LOG(logINFOBLUE, ("Configuring 10G MAC\n"));
uint32_t sourceport = DEFAULT_TX_UDP_PORT;
FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n",
(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip));
FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
(unsigned int)((sourcemac>>40)&0xFF),
(unsigned int)((sourcemac>>32)&0xFF),
(unsigned int)((sourcemac>>24)&0xFF),
(unsigned int)((sourcemac>>16)&0xFF),
(unsigned int)((sourcemac>>8)&0xFF),
(unsigned int)((sourcemac>>0)&0xFF),
(long long unsigned int)sourcemac));
FILE_LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n",sourceport, sourceport));
FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n",
(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip));
FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
(unsigned int)((sourcemac>>40)&0xFF),
(unsigned int)((sourcemac>>32)&0xFF),
(unsigned int)((sourcemac>>24)&0xFF),
(unsigned int)((sourcemac>>16)&0xFF),
(unsigned int)((sourcemac>>8)&0xFF),
(unsigned int)((sourcemac>>0)&0xFF),
(long long unsigned int)sourcemac));
FILE_LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n",sourceport, sourceport));
FILE_LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n",
(destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff, destip));
FILE_LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
(unsigned int)((destmac>>40)&0xFF),
(unsigned int)((destmac>>32)&0xFF),
(unsigned int)((destmac>>24)&0xFF),
(unsigned int)((destmac>>16)&0xFF),
(unsigned int)((destmac>>8)&0xFF),
(unsigned int)((destmac>>0)&0xFF),
(long long unsigned int)destmac));
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n",udpport, udpport));
FILE_LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n",
(destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff, destip));
FILE_LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
(unsigned int)((destmac>>40)&0xFF),
(unsigned int)((destmac>>32)&0xFF),
(unsigned int)((destmac>>24)&0xFF),
(unsigned int)((destmac>>16)&0xFF),
(unsigned int)((destmac>>8)&0xFF),
(unsigned int)((destmac>>0)&0xFF),
(long long unsigned int)destmac));
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n",udpport, udpport));
long int checksum=calcChecksum(sourceip, destip);
bus_w(TX_IP_REG, sourceip);
bus_w(RX_IP_REG, destip);
long int checksum=calcChecksum(sourceip, destip);
bus_w(TX_IP_REG, sourceip);
bus_w(RX_IP_REG, destip);
uint32_t val = 0;
uint32_t val = 0;
val = ((sourcemac >> LSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
bus_w(TX_MAC_LSB_REG, val);
FILE_LOG(logDEBUG1, ("Read from TX_MAC_LSB_REG: 0x%08x\n", bus_r(TX_MAC_LSB_REG)));
val = ((sourcemac >> LSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
bus_w(TX_MAC_LSB_REG, val);
FILE_LOG(logDEBUG1, ("Read from TX_MAC_LSB_REG: 0x%08x\n", bus_r(TX_MAC_LSB_REG)));
val = ((sourcemac >> MSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
bus_w(TX_MAC_MSB_REG,val);
FILE_LOG(logDEBUG1, ("Read from TX_MAC_MSB_REG: 0x%08x\n", bus_r(TX_MAC_MSB_REG)));
val = ((sourcemac >> MSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
bus_w(TX_MAC_MSB_REG,val);
FILE_LOG(logDEBUG1, ("Read from TX_MAC_MSB_REG: 0x%08x\n", bus_r(TX_MAC_MSB_REG)));
val = ((destmac >> LSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
bus_w(RX_MAC_LSB_REG, val);
FILE_LOG(logDEBUG1, ("Read from RX_MAC_LSB_REG: 0x%08x\n", bus_r(RX_MAC_LSB_REG)));
val = ((destmac >> LSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
bus_w(RX_MAC_LSB_REG, val);
FILE_LOG(logDEBUG1, ("Read from RX_MAC_LSB_REG: 0x%08x\n", bus_r(RX_MAC_LSB_REG)));
val = ((destmac >> MSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
bus_w(RX_MAC_MSB_REG, val);
FILE_LOG(logDEBUG1, ("Read from RX_MAC_MSB_REG: 0x%08x\n", bus_r(RX_MAC_MSB_REG)));
val = ((destmac >> MSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
bus_w(RX_MAC_MSB_REG, val);
FILE_LOG(logDEBUG1, ("Read from RX_MAC_MSB_REG: 0x%08x\n", bus_r(RX_MAC_MSB_REG)));
val = (((sourceport << UDP_PORT_TX_OFST) & UDP_PORT_TX_MSK) |
((udpport << UDP_PORT_RX_OFST) & UDP_PORT_RX_MSK));
bus_w(UDP_PORT_REG, val);
FILE_LOG(logDEBUG1, ("Read from UDP_PORT_REG: 0x%08x\n", bus_r(UDP_PORT_REG)));
val = (((sourceport << UDP_PORT_TX_OFST) & UDP_PORT_TX_MSK) |
((udpport << UDP_PORT_RX_OFST) & UDP_PORT_RX_MSK));
bus_w(UDP_PORT_REG, val);
FILE_LOG(logDEBUG1, ("Read from UDP_PORT_REG: 0x%08x\n", bus_r(UDP_PORT_REG)));
bus_w(TX_IP_CHECKSUM_REG,(checksum << TX_IP_CHECKSUM_OFST) & TX_IP_CHECKSUM_MSK);
FILE_LOG(logDEBUG1, ("Read from TX_IP_CHECKSUM_REG: 0x%08x\n", bus_r(TX_IP_CHECKSUM_REG)));
bus_w(TX_IP_CHECKSUM_REG,(checksum << TX_IP_CHECKSUM_OFST) & TX_IP_CHECKSUM_MSK);
FILE_LOG(logDEBUG1, ("Read from TX_IP_CHECKSUM_REG: 0x%08x\n", bus_r(TX_IP_CHECKSUM_REG)));
cleanFifos();//FIXME: resetPerpheral() for ctb?
resetPeripheral();
usleep(WAIT_TIME_CONFIGURE_MAC); // todo maybe without
}
cleanFifos();//FIXME: resetPerpheral() for ctb?
resetPeripheral();
FILE_LOG(logINFO, ("Waiting for %d s for mac to be up\n", WAIT_TIME_CONFIGURE_MAC / (1000 * 1000)));
usleep(WAIT_TIME_CONFIGURE_MAC); // todo maybe without
return OK;
}

View File

@ -83,7 +83,7 @@ enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7, D8, D9,
#define WAIT_TME_US_FR_ACQDONE_REG (100) // wait time in us after acquisition done to ensure there is no data in fifo
#define WAIT_TIME_US_PLL (10 * 1000)
#define WAIT_TIME_US_STP_ACQ (100)
#define WAIT_TIME_CONFIGURE_MAC (500 * 1000)
#define WAIT_TIME_CONFIGURE_MAC (2 * 1000 * 1000)
#define WAIT_TIME_PATTERN_READ (10)
#define WAIT_TIME_1US_FOR_LOOP_CNT (50) // around 30 is 1 us in blackfin

View File

@ -3,13 +3,13 @@ main_inc = ../slsDetectorServer/include/
main_src = ../slsDetectorServer/src/
support_lib = ../../slsSupportLib/include/
CROSS = powerpc-4xx-softfloat-
BLACKFIN_CC = bfin-uclinux-gcc
CROSS = powerpc-4xx-softfloat-
CC = $(CROSS)gcc
CFLAGS += -Wall -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
PROGS = eigerDetectorServer
DESTDIR ?= bin
DESTDIR = bin
INSTMODE = 0777
SRCS = slsDetectorFunctionList.c HardwareIO.c LocalLinkInterface.c FebInterface.c FebControl.c Beb.c
@ -17,7 +17,7 @@ SRCS += $(main_src)communication_funcs.c $(main_src)slsDetectorServer.c $(main_
OBJS = $(SRCS:.c=.o)
all: clean versioning $(PROGS) #hv9m_blackfin_server
all: clean versioning $(PROGS) #hv9m_blackfin_server
boot: $(OBJS)

View File

@ -56,7 +56,7 @@ int eiger_theo_highvoltage = 0;
int eiger_iodelay = 0;
int eiger_photonenergy = 0;
int eiger_dynamicrange = 0;
int eiger_readoutmode = 0;
int eiger_parallelmode = 0;
int eiger_storeinmem = 0;
int eiger_overflow32 = 0;
int eiger_readoutspeed = 0;
@ -439,9 +439,9 @@ void setupDetector() {
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
eiger_photonenergy = DEFAULT_PHOTON_ENERGY;
setReadOutFlags(DEFAULT_READOUT_MODE);
setReadOutFlags(DEFAULT_READOUT_STOREINRAM_MODE);
setReadOutFlags(DEFAULT_READOUT_OVERFLOW32_MODE);
setParallelMode(DEFAULT_PARALLEL_MODE);
setOverFlowMode(DEFAULT_READOUT_STOREINRAM_MODE);
setStoreInRamMode(DEFAULT_READOUT_OVERFLOW32_MODE);
setSpeed(CLOCK_DIVIDER, DEFAULT_CLK_SPEED);//clk_devider,half speed
setIODelay(DEFAULT_IO_DELAY);
setTiming(DEFAULT_TIMING_MODE);
@ -543,118 +543,45 @@ int getSpeed(enum speedVariable ind) {
return eiger_readoutspeed;
}
enum readOutFlags setReadOutFlags(enum readOutFlags val) {
enum readOutFlags retval = GET_READOUT_FLAGS;
if (val!=GET_READOUT_FLAGS) {
if (val&0xF0000) {
switch(val) {
case PARALLEL:
val=E_PARALLEL;
FILE_LOG(logDEBUG1, ("Setting Read out Flag: Parallel\n"));
break;
case NONPARALLEL:
val=E_NON_PARALLEL;
FILE_LOG(logDEBUG1, ("Setting Read out Flag: Non Parallel\n"));
break;
default:
FILE_LOG(logERROR, ("Cannot set unknown readout flag. 0x%x\n", val));
return -1;
}
int setParallelMode(int mode) {
mode = (mode == 0 ? E_NON_PARALLEL : E_PARALLEL);
#ifndef VIRTUAL
if (Feb_Control_SetReadoutMode(val))
#endif
eiger_readoutmode = val;
#ifndef VIRTUAL
else return -1;
#endif
}
else if (val&0xF00000) {
switch(val) {
case SHOW_OVERFLOW:
val=1;
FILE_LOG(logDEBUG1, ("Setting Read out Flag: Overflow in 32 bit mode\n"));
break;
case NOOVERFLOW:
val=0;
FILE_LOG(logDEBUG1, ("Setting Read out Flag: No overflow in 32 bit mode\n"));
break;
default:
FILE_LOG(logERROR, ("Cannot set unknown readout flag. 0x%x\n", val));
return -1;
}
#ifndef VIRTUAL
if (Beb_Set32bitOverflow(val) != -1)
#endif
eiger_overflow32 = val;
#ifndef VIRTUAL
else return -1;
#endif
}
else {
switch(val) {
case STORE_IN_RAM:
val=1;
FILE_LOG(logDEBUG1, ("Setting Read out Flag: Store in Ram\n"));
break;
case CONTINOUS_RO:
val=0;
FILE_LOG(logDEBUG1, ("Setting Read out Flag: Continuous Readout\n"));
break;
default:
FILE_LOG(logERROR, ("Cannot set unknown readout flag. 0x%x\n", val));
return -1;
}
eiger_storeinmem = val;
}
if (!Feb_Control_SetReadoutMode(mode)) {
return FAIL;
}
switch(eiger_readoutmode) {
case E_PARALLEL:
retval=PARALLEL;
break;
case E_NON_PARALLEL:
retval=NONPARALLEL;
break;
}
switch(eiger_overflow32) {
case 1:
retval|=SHOW_OVERFLOW;
break;
case 0:
retval|=NOOVERFLOW;
break;
}
switch(eiger_storeinmem) {
case 0:
retval|=CONTINOUS_RO;
break;
case 1:
retval|=STORE_IN_RAM;
break;
}
FILE_LOG(logDEBUG1, ("Read out Flag: 0x%x\n", retval));
return retval;
#endif
eiger_parallelmode = mode;
return OK;
}
int getParallelMode() {
return (eiger_parallelmode == E_PARALLEL ? 1 : 0);
}
int setOverFlowMode(int mode) {
mode = (mode == 0 ? 0 : 1);
#ifndef VIRTUAL
if (Beb_Set32bitOverflow(mode == 0 ? 0 : 1) == -1) {
return FAIL;
}
#endif
eiger_overflow32 = mode;
return OK;
}
int getOverFlowMode() {
return eiger_overflow32;
}
void setStoreInRamMode(int mode) {
mode = (mode == 0 ? 0 : 1);
FILE_LOG(logINFO, ("Setting Store in Ram mode to %d\n", mode));
eiger_storeinmem = mode;
}
int getStoreInRamMode() {
return eiger_storeinmem;
}
/* parameters - timer */

View File

@ -9,7 +9,6 @@
#define STATUS_ERROR 2
/* Enums */
enum CLK_SPEED_INDEX {FULL_SPEED, HALF_SPEED, QUARTER_SPEED};
enum DACINDEX {SVP,VTR,VRF,VRS,SVN,VTGSTV,VCMP_LL,VCMP_LR,CAL,VCMP_RL,RXB_RB,RXB_LB,VCMP_RR,VCP,VCN,VIS,VTHRESHOLD};
#define DEFAULT_DAC_VALS { \
0, /* SvP */ \
@ -31,7 +30,7 @@ enum DACINDEX {SVP,VTR,VRF,VRS,SVN,VTGSTV,VCMP_LL,VCMP_LR,CAL,VCMP_RL,RX
};
enum ADCINDEX {TEMP_FPGAEXT, TEMP_10GE, TEMP_DCDC, TEMP_SODL, TEMP_SODR, TEMP_FPGA, TEMP_FPGAFEBL, TEMP_FPGAFEBR};
enum NETWORKINDEX {TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G};
enum {E_PARALLEL, E_NON_PARALLEL, E_SAFE};
enum {E_PARALLEL, E_NON_PARALLEL};
/* Hardware Definitions */
#define NCHAN (256 * 256)
@ -62,9 +61,9 @@ enum {E_PARALLEL, E_NON_PARALLEL, E_SAFE};
#define DEFAULT_SUBFRAME_DEADTIME (0)
#define DEFAULT_DYNAMIC_RANGE (16)
#define DEFAULT_READOUT_MODE (NONPARALLEL)
#define DEFAULT_READOUT_STOREINRAM_MODE (CONTINOUS_RO)
#define DEFAULT_READOUT_OVERFLOW32_MODE (NOOVERFLOW)
#define DEFAULT_PARALLEL_MODE (0)
#define DEFAULT_READOUT_STOREINRAM_MODE (0)
#define DEFAULT_READOUT_OVERFLOW32_MODE (0)
#define DEFAULT_CLK_SPEED (HALF_SPEED)
#define DEFAULT_IO_DELAY (650)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)

View File

@ -37,7 +37,6 @@ typedef struct udp_header_struct {
/* Enums */
enum CLK_SPEED_INDEX {FULL_SPEED, HALF_SPEED, QUARTER_SPEED};
enum ADCINDEX {TEMP_FPGA, TEMP_ADC};
enum DACINDEX {VB_COMP, VDD_PROT, VIN_COM, VREF_PRECH, VB_PIXBUF, VB_DS, VREF_DS, VREF_COMP };
#define DEFAULT_DAC_VALS { 1220, /* VB_COMP */ \

View File

@ -47,6 +47,7 @@ static inline void FILELOG_PrintLog(enum TLogLevel level, char* m) {
case logDEBUG4: cprintf(MAGENTA, "DEBUG4: %s", m); break;
case logDEBUG5: cprintf(MAGENTA, "DEBUG5: %s", m); break;
}
fflush(stdout);
}
static inline char* FILELOG_BuildLog(const char* fmt, ...) {

View File

@ -138,9 +138,20 @@ int getSpeed(enum speedVariable ind);
#endif
#endif
#if defined(EIGERD) || defined(CHIPTESTBOARDD)
enum readOutFlags setReadOutFlags(enum readOutFlags val);
#ifdef EIGERD
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);
int getReadoutMode();
#endif
// parameters - timer
#ifdef JUNGFRAUD

View File

@ -47,7 +47,6 @@ int read_all(int);
int set_timer(int);
int get_time_left(int);
int set_dynamic_range(int);
int set_readout_flags(int);
int set_roi(int);
int get_roi(int);
int set_speed(int);
@ -109,3 +108,11 @@ int set_interrupt_subframe(int);
int get_interrupt_subframe(int);
int set_read_n_lines(int);
int get_read_n_lines(int);
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);

View File

@ -191,7 +191,6 @@ const char* getFunctionName(enum detFuncs func) {
case F_SET_TIMER: return "F_SET_TIMER";
case F_GET_TIME_LEFT: return "F_GET_TIME_LEFT";
case F_SET_DYNAMIC_RANGE: return "F_SET_DYNAMIC_RANGE";
case F_SET_READOUT_FLAGS: return "F_SET_READOUT_FLAGS";
case F_SET_ROI: return "F_SET_ROI";
case F_GET_ROI: return "F_GET_ROI";
case F_SET_SPEED: return "F_SET_SPEED";
@ -251,6 +250,14 @@ const char* getFunctionName(enum detFuncs func) {
case F_GET_INTERRUPT_SUBFRAME: return "F_GET_INTERRUPT_SUBFRAME";
case F_SET_READ_N_LINES: return "F_SET_READ_N_LINES";
case F_GET_READ_N_LINES: return "F_GET_READ_N_LINES";
case F_SET_PARALLEL_MODE: return "F_SET_PARALLEL_MODE";
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";
default: return "Unknown Function";
}
}
@ -279,7 +286,6 @@ void function_table() {
flist[F_SET_TIMER] = &set_timer;
flist[F_GET_TIME_LEFT] = &get_time_left;
flist[F_SET_DYNAMIC_RANGE] = &set_dynamic_range;
flist[F_SET_READOUT_FLAGS] = &set_readout_flags;
flist[F_SET_ROI] = &set_roi;
flist[F_GET_ROI] = &get_roi;
flist[F_SET_SPEED] = &set_speed;
@ -339,6 +345,14 @@ void function_table() {
flist[F_GET_INTERRUPT_SUBFRAME] = &get_interrupt_subframe;
flist[F_SET_READ_N_LINES] = &set_read_n_lines;
flist[F_GET_READ_N_LINES] = &get_read_n_lines;
flist[F_SET_PARALLEL_MODE] = &set_parallel_mode;
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;
// check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
@ -1863,60 +1877,6 @@ int set_dynamic_range(int file_des) {
int set_readout_flags(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
enum readOutFlags arg = GET_READOUT_FLAGS;
enum readOutFlags retval = GET_READOUT_FLAGS;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
FILE_LOG(logDEBUG1, ("Setting readout flags to %d\n", arg));
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
functionNotImplemented();
#else
// set & get
if ((arg == GET_READOUT_FLAGS) || (Server_VerifyLock() == OK)) {
switch(arg) {
case GET_READOUT_FLAGS:
#ifdef EIGERD
case STORE_IN_RAM:
case CONTINOUS_RO:
case PARALLEL:
case NONPARALLEL:
case SHOW_OVERFLOW:
case NOOVERFLOW:
#elif CHIPTESTBOARDD
case NORMAL_READOUT:
case DIGITAL_ONLY:
case ANALOG_AND_DIGITAL:
#endif
retval = setReadOutFlags(arg);
FILE_LOG(logDEBUG1, ("Read out flags: 0x%x\n", retval));
validate((int)arg, (int)(retval & arg), "set readout flag", HEX);
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
if (retval == -2) {
ret = FAIL;
sprintf(mess, "Readout Flags failed. Cannot allocate RAM\n");
FILE_LOG(logERROR,(mess));
}
#endif
break;
default:
modeNotImplemented("Read out flag index", (int)arg);
break;
}
}
#endif
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
}
int set_roi(int file_des) {
ret = OK;
@ -2273,8 +2233,8 @@ int send_update(int file_des) {
if (n < 0) return printSocketReadError();
// readout flags
#if defined(EIGERD) || defined(CHIPTESTBOARDD)
i32 = setReadOutFlags(GET_READOUT_FLAGS);
#ifdef CHIPTESTBOARDD
i32 = getReadoutMode();
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
#endif
@ -4151,3 +4111,211 @@ int get_read_n_lines(int file_des) {
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
}
int set_parallel_mode(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int arg = 0;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
FILE_LOG(logINFO, ("Setting parallel mode: %u\n", arg));
#ifndef EIGERD
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
if(setParallelMode(arg) == FAIL) {
ret = FAIL;
sprintf(mess, "Could not set parallel mode\n");
FILE_LOG(logERROR,(mess));
} else {
int retval = getParallelMode();
if (arg != retval) {
ret = FAIL;
sprintf(mess, "Could not set parallel mode. Set %d, but read %d\n", retval, arg);
FILE_LOG(logERROR,(mess));
}
}
}
#endif
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
}
int get_parallel_mode(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
FILE_LOG(logDEBUG1, ("Getting parallel mode\n"));
#ifndef EIGERD
functionNotImplemented();
#else
// get only
retval = getParallelMode();
FILE_LOG(logDEBUG1, ("parallel mode retval: %u\n", retval));
#endif
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
}
int set_overflow_mode(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int arg = 0;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
FILE_LOG(logINFO, ("Setting overflow mode: %u\n", arg));
#ifndef EIGERD
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
if(setOverFlowMode(arg) == FAIL) {
ret = FAIL;
sprintf(mess, "Could not set overflow mode\n");
FILE_LOG(logERROR,(mess));
} else {
int retval = getOverFlowMode();
if (arg != retval) {
ret = FAIL;
sprintf(mess, "Could not set overflow mode. Set %d, but read %d\n", retval, arg);
FILE_LOG(logERROR,(mess));
}
}
}
#endif
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
}
int get_overflow_mode(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
FILE_LOG(logDEBUG1, ("Getting overflow mode\n"));
#ifndef EIGERD
functionNotImplemented();
#else
// get only
retval = getOverFlowMode();
FILE_LOG(logDEBUG1, ("overflow mode retval: %u\n", retval));
#endif
return Server_SendResult(file_des, INT32, UPDATE, &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();
FILE_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, UPDATE, NULL, 0);
}
int get_storeinram(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
FILE_LOG(logDEBUG1, ("Getting store in ram mode\n"));
#ifndef EIGERD
functionNotImplemented();
#else
// get only
retval = getStoreInRamMode();
FILE_LOG(logDEBUG1, ("store in ram mode retval: %u\n", retval));
#endif
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
}
int set_readout_mode(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int arg = 0;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
FILE_LOG(logINFO, ("Setting readout mode: %u\n", arg));
#ifndef CHIPTESTBOARDD
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
switch(arg){
case ANALOG_ONLY:
case DIGITAL_ONLY:
case ANALOG_AND_DIGITAL:
break;
default:
modeNotImplemented("Readout mode", (int)arg);
break;
}
if (ret == OK) {
if (setReadoutMode(arg) == FAIL) {
ret = FAIL;
sprintf(mess, "Could not set allocate RAM to set readout mode\n");
FILE_LOG(logERROR,(mess));
} else {
int retval = getReadoutMode();
if (retval == -1) {
ret = FAIL;
sprintf(mess, "Could not get readout mode\n");
FILE_LOG(logERROR,(mess));
} else {
FILE_LOG(logDEBUG1, ("readout mode retval: %u\n", retval));
}
validate(arg, retval, "set readout mode", DEC);
}
}
}
#endif
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
}
int get_readout_mode(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
FILE_LOG(logDEBUG1, ("Getting readout mode\n"));
#ifndef CHIPTESTBOARDD
functionNotImplemented();
#else
// get only
retval = getReadoutMode();
if (retval == -1) {
ret = FAIL;
sprintf(mess, "Could not get readout mode\n");
FILE_LOG(logERROR,(mess));
} else {
FILE_LOG(logDEBUG1, ("readout mode retval: %u\n", retval));
}
#endif
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
}

View File

@ -114,6 +114,9 @@ class CmdProxy {
{"period", &CmdProxy::Period},
{"subexptime", &CmdProxy::SubExptime},
{"frames", &CmdProxy::frames},
{"parallel", &CmdProxy::parallel},
{"overflow", &CmdProxy::overflow},
{"storeinram", &CmdProxy::storeinram},
{"fwrite", &CmdProxy::fwrite},
{"fmaster", &CmdProxy::fmaster},
{"foverwrite", &CmdProxy::foverwrite},
@ -144,7 +147,8 @@ class CmdProxy {
{"masterfile", "fmaster"},
{"outdir", "fpath"},
{"fileformat", "fformat"},
{"overwrite", "foverwrite"}};
{"overwrite", "foverwrite"},
{"flags", "readout"}};
void WrongNumberOfParameters(size_t expected);
@ -193,6 +197,15 @@ class CmdProxy {
INTEGER_COMMAND(findex, getAcquisitionIndex, setAcquisitionIndex, std::stoi,
"[0, 1]\n\tFile index");
INTEGER_COMMAND(parallel, getParallelMode, setParallelMode, std::stoi,
"[0, 1]\n\tEnable or disable parallel mode. [Eiger]");
INTEGER_COMMAND(overflow, getOverFlowMode, setOverFlowMode, std::stoi,
"[0, 1]\n\tEnable or disable show overflow flag in 32 bit mode. [Eiger]");
INTEGER_COMMAND(storeinram, getStoreInRamMode, setStoreInRamMode, std::stoi,
"[0, 1]\n\tEnable or disable store in ram mode. [Eiger]");
};
} // namespace sls

View File

@ -154,12 +154,11 @@ class Detector {
Result<ns> getDelayAfterTriggerLeft(Positions pos = {}) const;
/** [Eiger][Jungfrau] */
Result<int> getSpeed(Positions pos = {}) const;
Result<defs::speedLevel> getSpeed(Positions pos = {}) const;
/** [Eiger][Jungfrau] // TODO: create enum for speed
* Options: (0 full speed, 1 half speed, 2 quarter speed)
*/
void setSpeed(int value, Positions pos = {});
/** [Eiger][Jungfrau]
* Options: FULL_SPEED, HALF_SPEED, QUARTER_SPEED */
void setSpeed(defs::speedLevel value, Positions pos = {});
/** [Gotthard][Jungfrau][CTB] */
Result<int> getADCPhase(Positions pos = {}) const;
@ -636,6 +635,12 @@ 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;
@ -852,11 +857,10 @@ class Detector {
void setNumberOfDigitalSamples(int64_t value, Positions pos = {});
/** [CTB] */
Result<int> getReadoutMode(Positions pos = {}) const;
Result<defs::readoutMode> getReadoutMode(Positions pos = {}) const;
/** [CTB] Options: NORMAL_READOUT = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL
* //TODO ANALOG_ONLY, make enum = 2 */
void setReadoutMode(int value, Positions pos = {});
/** [CTB] Options: ANALOG_ONLY = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL */
void setReadoutMode(defs::readoutMode value, Positions pos = {});
/** [CTB] */
Result<int> getDBITPhase(Positions pos = {}) const;

View File

@ -778,14 +778,18 @@ class multiSlsDetector : public virtual slsDetectorDefs {
int detPos = -1); //
/**
* Set/get readout flags (Eiger, Mythen)
* @param flag readout flag (Eiger options: parallel, nonparallel, safe
* etc.) (-1 gets)
* Set readout mode (Only for CTB and Moench)
* @param mode readout mode Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL
* @param detPos -1 for all detectors in list or specific detector position
* @returns readout flag
*/
int setReadOutFlags(readOutFlags flag = GET_READOUT_FLAGS,
int detPos = -1); //
void setReadoutMode(const readoutMode mode, int detPos = -1);
/**
* Get readout mode(Only for CTB and Moench)
* @param detPos -1 for all detectors in list or specific detector position
* @returns readout mode
*/
readoutMode getReadoutMode(int detPos = -1);
/**
* Set Interrupt last sub frame (Only for Eiger)

View File

@ -68,8 +68,8 @@ struct sharedSlsDetector {
/** adc enable mask */
uint32_t adcEnableMask;
/** readout flags */
slsDetectorDefs::readOutFlags roFlags;
/** readout mode */
slsDetectorDefs::readoutMode roMode;
/** detector settings (standard, fast, etc.) */
slsDetectorDefs::detectorSettings currentSettings;
@ -629,12 +629,52 @@ class slsDetector : public virtual slsDetectorDefs {
setExternalSignalFlags(externalSignalFlag pol = GET_EXTERNAL_SIGNAL_FLAG);
/**
* Set/get readout flags (Eiger, Mythen)
* @param flag readout flag (Eiger options: parallel, nonparallel, safe
* etc.) (-1 gets)
* @returns readout flag
* Set Parallel readout mode (Only for Eiger)
* @param enable true if parallel, else false for non parallel
*/
int setReadOutFlags(readOutFlags flag = GET_READOUT_FLAGS);
void setParallelMode(const bool enable);
/**
* Get parallel mode (Only for Eiger)
* @returns parallel mode
*/
bool getParallelMode();
/**
* Set overflow readout mode in 32 bit mode (Only for Eiger)
* @param enable true if overflow, else false
*/
void setOverFlowMode(const bool enable);
/**
* Get overflow mode in 32 bit mode (Only for Eiger)
* @returns overflow mode
*/
bool getOverFlowMode();
/**
* Set store in ram readout mode (Only for Eiger)
* @param enable true if store in ram, else false
*/
void setStoreInRamMode(const bool enable);
/**
* Get store in ram mode (Only for Eiger)
* @returns store in ram mode
*/
bool getStoreInRamMode();
/**
* Set readout mode (Only for CTB and Moench)
* @param mode readout mode Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL
*/
void setReadoutMode(const readoutMode mode);
/**
* Get readout mode(Only for CTB and Moench)
* @returns readout mode
*/
readoutMode getReadoutMode();
/**
* Set Interrupt last sub frame (Only for Eiger)

View File

@ -398,22 +398,20 @@ public:
/**
* Set parallel readout mode (Eiger)
* @param value readout mode (-1 gets)
* Options: slsDetectorDefs::readOutFlags
* (PARALLEL, NONPARALLEL (Default), SAFE)
* false for NonParallel (Default), true for Parallel
* @param detPos -1 for all detectors in list or specific detector position
* @returns mode register,
* result must be ANDED with PARALLEL/NONPARALLEL/SAFE to get mode
* @returns 1 for parallel, 0 for non parallel, -1 if different
*/
int setParallelMode(int value, int detPos = -1);
int setParallelMode(bool value, int detPos = -1);
/**
* Set overflow readout mode (Eiger in 32 bit)
* @param value readout mode (-1 gets)
* Options: 1(SHOW_OVERFLOW), 0(NOOVERFLOW) (Default)
* Options: true to Show overflow, false to not show overflow
* @param detPos -1 for all detectors in list or specific detector position
* @returns 1 if overflow mode else 0
* @returns 1 for overflow, 0 for no overflow, -1 if different
*/
int setOverflowMode(int value, int detPos = -1);
int setOverflowMode(bool value, int detPos = -1);
/**
* (Advanced user)

View File

@ -1,10 +1,10 @@
#include "Detector.h"
#include "container_utils.h"
#include "detectorData.h"
#include "logger.h"
#include "multiSlsDetector.h"
#include "slsDetector.h"
#include "sls_detector_defs.h"
#include "detectorData.h"
namespace sls {
@ -165,13 +165,19 @@ Result<ns> Detector::getDelayAfterTriggerLeft(Positions pos) const {
defs::DELAY_AFTER_TRIGGER);
}
Result<int> Detector::getSpeed(Positions pos) const {
return pimpl->Parallel(&slsDetector::setSpeed, pos, defs::CLOCK_DIVIDER, -1,
Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setSpeed, pos, defs::CLOCK_DIVIDER, -1,
0);
Result<defs::speedLevel> speedResult(res.size());
for (size_t i = 0; i < res.size(); ++i) {
speedResult[i] = static_cast<defs::speedLevel>(res[i]);
}
return speedResult;
}
void Detector::setSpeed(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::CLOCK_DIVIDER, value, 0);
void Detector::setSpeed(defs::speedLevel value, Positions pos) {
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::CLOCK_DIVIDER,
static_cast<int>(value), 0);
}
Result<int> Detector::getADCPhase(Positions pos) const {
@ -265,7 +271,7 @@ void Detector::startAcquisition() {
void Detector::stopAcquisition() {
pimpl->Parallel(&slsDetector::stopAcquisition, {});
if (getUseReceiverFlag().squash(true))
if (getUseReceiverFlag().squash(true))
pimpl->Parallel(&slsDetector::stopReceiver, {});
}
@ -640,7 +646,8 @@ void Detector::setRxZmqDataStream(bool enable, Positions pos) {
}
Result<int> Detector::getRxZmqFrequency(Positions pos) const {
return pimpl->Parallel(&slsDetector::setReceiverStreamingFrequency, pos, -1);
return pimpl->Parallel(&slsDetector::setReceiverStreamingFrequency, pos,
-1);
}
void Detector::setRxZmqFrequency(int freq, Positions pos) {
@ -775,33 +782,27 @@ void Detector::setRxAddGapPixels(bool enable) {
}
Result<bool> Detector::getParallelMode(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
defs::GET_READOUT_FLAGS);
Result<bool> booleanRes(res.size());
for (size_t i = 0; i < res.size(); ++i) {
booleanRes[i] = res[i] & defs::PARALLEL;
}
return booleanRes;
return pimpl->Parallel(&slsDetector::getParallelMode, pos);
}
void Detector::setParallelMode(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
value ? defs::PARALLEL : defs::NONPARALLEL);
pimpl->Parallel(&slsDetector::setParallelMode, pos, value);
}
Result<bool> Detector::getOverFlowMode(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
defs::GET_READOUT_FLAGS);
Result<bool> booleanRes(res.size());
for (size_t i = 0; i < res.size(); ++i) {
booleanRes[i] = res[i] & defs::SHOW_OVERFLOW;
}
return booleanRes;
return pimpl->Parallel(&slsDetector::getOverFlowMode, pos);
}
void Detector::setOverFlowMode(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
value ? defs::SHOW_OVERFLOW : defs::NOOVERFLOW);
pimpl->Parallel(&slsDetector::setOverFlowMode, pos, value);
}
Result<bool> Detector::getStoreInRamMode(Positions pos) const {
return pimpl->Parallel(&slsDetector::getStoreInRamMode, pos);
}
void Detector::setStoreInRamMode(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::setStoreInRamMode, pos, value);
}
Result<bool> Detector::getBottom(Positions pos) const {
@ -1056,39 +1057,12 @@ void Detector::setNumberOfDigitalSamples(int64_t value, Positions pos) {
pimpl->Parallel(&slsDetector::setTimer, pos, defs::DIGITAL_SAMPLES, value);
}
Result<int> Detector::getReadoutMode(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
defs::GET_READOUT_FLAGS);
for (auto &it : res) {
if (it & defs::ANALOG_AND_DIGITAL) {
it = 2;
} else if (it & defs::DIGITAL_ONLY) {
it = 1;
} else if (it == defs::NORMAL_READOUT) {
it = 0;
} else {
throw RuntimeError("Unknown Signal Type");
}
}
return res;
Result<defs::readoutMode> Detector::getReadoutMode(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReadoutMode, pos);
}
void Detector::setReadoutMode(int value, Positions pos) {
defs::readOutFlags flag;
switch (value) {
case 0:
flag = defs::NORMAL_READOUT;
break;
case 1:
flag = defs::DIGITAL_ONLY;
break;
case 2:
flag = defs::ANALOG_AND_DIGITAL;
break;
default:
throw RuntimeError("Unknown Signal Type");
}
pimpl->Parallel(&slsDetector::setReadOutFlags, pos, flag);
void Detector::setReadoutMode(defs::readoutMode value, Positions pos) {
pimpl->Parallel(&slsDetector::setReadoutMode, pos, value);
}
Result<int> Detector::getDBITPhase(Positions pos) const {

View File

@ -1154,14 +1154,24 @@ multiSlsDetector::setExternalSignalFlags(externalSignalFlag pol, int detPos) {
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::setReadOutFlags(readOutFlags flag, int detPos) {
void multiSlsDetector::setReadoutMode(const slsDetectorDefs::readoutMode mode, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReadOutFlags(flag);
detectors[detPos]->setReadoutMode(mode);
}
// multi
auto r = parallelCall(&slsDetector::setReadOutFlags, flag);
parallelCall(&slsDetector::setReadoutMode, mode);
}
slsDetectorDefs::readoutMode multiSlsDetector::getReadoutMode(int detPos) {
// single
if (detPos >= 0) {
return (detectors[detPos]->getReadoutMode());
}
// multi
auto r = parallelCall(&slsDetector::getReadoutMode);
return sls::minusOneIfDifferent(r);
}

View File

@ -317,7 +317,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->roi.xmin = -1;
shm()->roi.xmax = -1;
shm()->adcEnableMask = BIT32_MASK;
shm()->roFlags = NORMAL_READOUT;
shm()->roMode = ANALOG_ONLY;
shm()->currentSettings = UNINITIALIZED;
shm()->currentThresholdEV = -1;
shm()->timerValue[FRAME_NUMBER] = 1;
@ -417,7 +417,6 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->nGappixels.y = parameters.nGappixelsY;
// update #nchan, as it depends on #samples, adcmask,
// readoutflags (ctb only)
updateNumberOfChannels();
}
@ -573,8 +572,8 @@ void slsDetector::updateNumberOfChannels() {
int nachans = 0, ndchans = 0;
// analog channels (normal, analog/digital readout)
if (shm()->roFlags == slsDetectorDefs::NORMAL_READOUT ||
((shm()->roFlags & slsDetectorDefs::ANALOG_AND_DIGITAL) != 0)) {
if (shm()->roMode == slsDetectorDefs::ANALOG_ONLY ||
shm()->roMode == slsDetectorDefs::ANALOG_AND_DIGITAL) {
uint32_t mask = shm()->adcEnableMask;
if (mask == BIT32_MASK) {
nachans = 32;
@ -589,8 +588,8 @@ void slsDetector::updateNumberOfChannels() {
// digital channels (ctb only, digital, analog/digital readout)
if (shm()->myDetectorType == CHIPTESTBOARD &&
(((shm()->roFlags & DIGITAL_ONLY) != 0) ||
((shm()->roFlags & ANALOG_AND_DIGITAL) != 0))) {
(shm()->roMode == DIGITAL_ONLY ||
shm()->roMode == ANALOG_AND_DIGITAL)) {
ndchans = 64;
FILE_LOG(logDEBUG1) << "#Digital Channels:" << ndchans;
}
@ -804,11 +803,10 @@ void slsDetector::updateCachedDetectorVariables() {
n += client.Receive(&i64, sizeof(i64));
shm()->timerValue[CYCLES_NUMBER] = i64;
// readout flags
if (shm()->myDetectorType == EIGER ||
shm()->myDetectorType == CHIPTESTBOARD) {
// readout mode
if (shm()->myDetectorType == CHIPTESTBOARD) {
n += client.Receive(&i32, sizeof(i32));
shm()->roFlags = static_cast<readOutFlags>(i32);
shm()->roMode = static_cast<readoutMode>(i32);
}
// roi
@ -841,7 +839,6 @@ void slsDetector::updateCachedDetectorVariables() {
setAdditionalJsonParameter("adcmask", std::to_string(u32));
// update #nchan, as it depends on #samples, adcmask,
// readoutflags
updateNumberOfChannels();
}
@ -1350,7 +1347,6 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
FILE_LOG(logDEBUG1) << getTimerType(index) << ": " << retval;
shm()->timerValue[index] = retval;
// update #nchan, as it depends on #samples, adcmask,
// readoutflags
if (index == ANALOG_SAMPLES || index == DIGITAL_SAMPLES) {
updateNumberOfChannels();
}
@ -1491,27 +1487,80 @@ slsDetector::setExternalSignalFlags(externalSignalFlag pol) {
return retval;
}
int slsDetector::setReadOutFlags(readOutFlags flag) {
auto arg = static_cast<int>(flag);
readOutFlags retval = GET_READOUT_FLAGS;
FILE_LOG(logDEBUG1) << "Setting readout flags to " << flag;
sendToDetector(F_SET_READOUT_FLAGS, arg, retval);
FILE_LOG(logDEBUG1) << "Readout flag: " << retval;
shm()->roFlags = retval;
void slsDetector::setParallelMode(const bool enable) {
int arg = static_cast<int>(enable);
FILE_LOG(logDEBUG1) << "Setting parallel mode to " << arg;
sendToDetector(F_SET_PARALLEL_MODE, arg, nullptr);
}
bool slsDetector::getParallelMode() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting parallel mode";
sendToDetector(F_GET_PARALLEL_MODE, nullptr, retval);
FILE_LOG(logDEBUG1) << "Parallel mode: " << retval;
return static_cast<bool>(retval);
}
void slsDetector::setOverFlowMode(const bool enable) {
int arg = static_cast<int>(enable);
FILE_LOG(logDEBUG1) << "Setting overflow mode to " << arg;
sendToDetector(F_SET_OVERFLOW_MODE, arg, nullptr);
}
bool slsDetector::getOverFlowMode() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting overflow mode";
sendToDetector(F_GET_OVERFLOW_MODE, nullptr, retval);
FILE_LOG(logDEBUG1) << "overflow mode: " << retval;
return static_cast<bool>(retval);
}
void slsDetector::setStoreInRamMode(const bool enable) {
int arg = static_cast<int>(enable);
FILE_LOG(logDEBUG1) << "Setting store in ram mode to " << arg;
sendToDetector(F_SET_STOREINRAM_MODE, arg, nullptr);
}
bool slsDetector::getStoreInRamMode() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting store in ram mode";
sendToDetector(F_GET_STOREINRAM_MODE, nullptr, retval);
FILE_LOG(logDEBUG1) << "store in ram mode: " << retval;
return static_cast<bool>(retval);
}
void slsDetector::setReadoutMode(const slsDetectorDefs::readoutMode mode) {
uint32_t arg = static_cast<uint32_t>(mode);
FILE_LOG(logDEBUG1) << "Setting readout mode to " << arg;
sendToDetector(F_SET_READOUT_MODE, arg, nullptr);
shm()->roMode = mode;
// update #nchan, as it depends on #samples, adcmask,
// readoutflags
if (shm()->myDetectorType == CHIPTESTBOARD) {
updateNumberOfChannels();
}
FILE_LOG(logDEBUG1) << "Setting receiver readout flags to " << arg;
if (shm()->useReceiverFlag) {
int fnum = F_RECEIVER_SET_READOUT_FLAGS;
arg = shm()->roFlags;
retval = static_cast<readOutFlags>(-1);
sendToReceiver(fnum, &arg, sizeof(arg), &retval, sizeof(retval));
FILE_LOG(logDEBUG1) << "Receiver readout flag: " << retval;
sendToReceiver(F_RECEIVER_SET_READOUT_MODE, mode, nullptr);
}
return shm()->roFlags;
}
slsDetectorDefs::readoutMode slsDetector::getReadoutMode() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting readout mode";
sendToDetector(F_GET_READOUT_MODE, nullptr, retval);
FILE_LOG(logDEBUG1) << "Readout mode: " << retval;
readoutMode oldmode = shm()->roMode;
shm()->roMode = static_cast<readoutMode>(retval);
if (oldmode != shm()->roMode) {
// update #nchan, as it depends on #samples, adcmask,
if (shm()->myDetectorType == CHIPTESTBOARD) {
updateNumberOfChannels();
}
if (shm()->useReceiverFlag) {
sendToReceiver(F_RECEIVER_SET_READOUT_MODE, shm()->roMode, nullptr);
}
}
return shm()->roMode;
}
void slsDetector::setInterruptSubframe(const bool enable) {
@ -1731,7 +1780,6 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
static_cast<int>(shm()->rxPadDeactivatedModules));
enableGapPixels(shm()->gappixels);
enableTenGigabitEthernet(shm()->tenGigaEnable);
setReadOutFlags(GET_READOUT_FLAGS);
setQuad(getQuad());
break;
@ -1739,7 +1787,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
setTimer(ANALOG_SAMPLES, shm()->timerValue[ANALOG_SAMPLES]);
setTimer(DIGITAL_SAMPLES, shm()->timerValue[DIGITAL_SAMPLES]);
enableTenGigabitEthernet(shm()->tenGigaEnable);
setReadOutFlags(GET_READOUT_FLAGS);
setReadoutMode(shm()->roMode);
setADCEnableMask(shm()->adcEnableMask);
setReceiverDbitOffset(shm()->rxDbitOffset);
setReceiverDbitList(shm()->rxDbitList);
@ -2276,7 +2324,6 @@ void slsDetector::setADCEnableMask(uint32_t mask) {
shm()->adcEnableMask = mask;
// update #nchan, as it depends on #samples, adcmask,
// readoutflags
updateNumberOfChannels();
// send to processor

View File

@ -351,9 +351,9 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
*/
/*! \page config
- <b>flags [flag]</b> sets/gets the readout flags to mode. Options: none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overflow, nooverflow, unknown. Used for EIGER only. \c Returns \c (string). put takes one string and \c returns concatenation of all active flags separated by spaces.
- <b>romode [b]</b> sets/gets the readout flag. Options: analog, digital, analog_digital. Used for CTB only. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "flags";
descrToFuncMap[i].m_pFuncName = "romode";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdAdvanced;
++i;
@ -691,7 +691,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
*/
/*! \page config
- <b>clkdivider [i]</b> sets/gets the readout clock divider. EIGER, JUNGFRAU [0(fast speed), 1(half speed), 2(quarter speed)]. Jungfrau, full speed is not implemented and overwrites adcphase to recommended default. Not for Gotthard. \c Returns \c (int)
- <b>clkdivider [i]</b> sets/gets the readout clock divider. EIGER, JUNGFRAU [0(fast speed), 1(half speed), 2(quarter speed)]. Jungfrau also overwrites adcphase to recommended default. For CTB, it is the run clock in MHz. Not for Gotthard. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "clkdivider";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdSpeed;
@ -4282,8 +4282,14 @@ std::string slsDetectorCommand::cmdSpeed(int narg, const char * const args[], in
if (action == PUT_ACTION) {
if (sscanf(args[1], "%d", &t))
;
else
else {
// if parameer is a string (unknown speed will throw)
if (cmd == "clkdivider") {
speedLevel lev = getSpeedLevelType(std::string(args[1]));
t = static_cast<int>(lev);
}
return std::string("cannot scan speed value ") + std::string(args[1]);
}
}
@ -4325,72 +4331,17 @@ std::string slsDetectorCommand::helpSpeed(int action) {
std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[], int action, int detPos) {
char answer[1000] = "";
if (action == HELP_ACTION)
return helpAdvanced(action);
if (cmd == "flags") {
readOutFlags flag = GET_READOUT_FLAGS;
if (cmd == "romode") {
if (action == PUT_ACTION) {
std::string sval = std::string(args[1]);
if (sval == "none")
flag = NORMAL_READOUT;
else if (sval == "storeinram")
flag = STORE_IN_RAM;
else if (sval == "tot")
flag = TOT_MODE;
else if (sval == "continous")
flag = CONTINOUS_RO;
else if (sval == "parallel")
flag = PARALLEL;
else if (sval == "nonparallel")
flag = NONPARALLEL;
else if (sval == "digital")
flag = DIGITAL_ONLY;
else if (sval == "analog_digital")
flag = ANALOG_AND_DIGITAL;
else if (sval == "overflow")
flag = SHOW_OVERFLOW;
else if (sval == "nooverflow")
flag = NOOVERFLOW;
else
return std::string("could not scan flag ") + std::string(args[1]);
myDet->setReadoutMode(getReadoutModeType(std::string(args[1])), detPos);
}
return getReadoutModeType(myDet->getReadoutMode());
}
int retval = myDet->setReadOutFlags(flag, detPos);
// std::cout << std::hex << flag << " " << retval << std::endl;
if (retval == NORMAL_READOUT)
return std::string("none");
if (retval & STORE_IN_RAM)
strcat(answer, "storeinram ");
if (retval & TOT_MODE)
strcat(answer, "tot ");
if (retval & CONTINOUS_RO)
strcat(answer, "continous ");
if (retval & PARALLEL)
strcat(answer, "parallel ");
if (retval & NONPARALLEL)
strcat(answer, "nonparallel ");
if (retval & DIGITAL_ONLY)
strcat(answer, "digital ");
if (retval & ANALOG_AND_DIGITAL)
strcat(answer, "analog_digital ");
if (retval & SHOW_OVERFLOW)
strcat(answer, "overflow ");
if (retval & NOOVERFLOW)
strcat(answer, "nooverflow ");
if (strlen(answer))
return std::string(answer);
return std::string("unknown");
} else if (cmd=="interruptsubframe") {
else if (cmd=="interruptsubframe") {
if (action==PUT_ACTION) {
int ival = -1;
if (!sscanf(args[1],"%d",&ival))
@ -4399,7 +4350,9 @@ std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[],
}
return std::to_string(myDet->getInterruptSubframe());
} else if (cmd == "readnlines") {
}
else if (cmd == "readnlines") {
if (action == PUT_ACTION) {
int ival = -1;
if (!sscanf(args[1],"%d",&ival))
@ -4408,7 +4361,9 @@ std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[],
}
return std::to_string(myDet->getReadNLines());
} else if (cmd == "extsig") {
}
else if (cmd == "extsig") {
externalSignalFlag flag = GET_EXTERNAL_SIGNAL_FLAG;
if (action == PUT_ACTION) {
@ -4419,7 +4374,9 @@ std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[],
return myDet->externalSignalType(myDet->setExternalSignalFlags(flag, detPos));
} else if (cmd == "programfpga") {
}
else if (cmd == "programfpga") {
if (action == GET_ACTION)
return std::string("cannot get");
if (strstr(args[1], ".pof") == nullptr)
@ -4528,7 +4485,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
if (action == PUT_ACTION || action == HELP_ACTION) {
os << "extsig mode \t sets the mode of the external signal. can be trigger_out_rising_edge, trigger_out_falling_edge. Gotthard only" << std::endl;
os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overlow, nooverflow, unknown." << std::endl;
os << "romode m \t sets the readout flag to m. Options: analog, digital, analog_digital. Used for CTB only." << std::endl;
os << "interruptsubframe flag \t sets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl;
os << "readnlines f \t sets the number of rows to read out per half module. Options: 1 - 256 (Not all values as it depends on dynamic range and 10GbE enabled). Used for EIGER only. " << std::endl;
os << "programfpga f \t programs the fpga with file f (with .pof extension)." << std::endl;
@ -4544,7 +4501,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
if (action == GET_ACTION || action == HELP_ACTION) {
os << "extsig \t gets the mode of the external signal. can be trigger_in_rising_edge, trigger_in_falling_edge. Gotthard only" << std::endl;
os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overflow, nooverflow, unknown" << std::endl;
os << "romode \t gets the readout flag. Options: analog, digital, analog_digital. Used for CTB only." << std::endl;
os << "interruptsubframe \t gets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl;
os << "readnlines \t gets the number of rows to read out per half module. Used for EIGER only. " << std::endl;
os << "led \t returns led status (0 off, 1 on)" << std::endl;

View File

@ -167,23 +167,22 @@ int slsDetectorUsers::setClockDivider(int value, int detPos) {
return detector.setSpeed(slsDetectorDefs::CLOCK_DIVIDER, value, detPos);
}
int slsDetectorUsers::setParallelMode(int value, int detPos) {
if(value >= 0)
detector.setReadOutFlags(slsDetectorDefs::readOutFlags(value), detPos);
return detector.setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS, detPos);
int slsDetectorUsers::setParallelMode(bool value, int detPos) {
/* to be uncommented when moving to Detector.h
detector.setParallelMode(value, {detPos});
auto res = detector.getParallelMode({detPos});
if (res.equal())
return res.front();*/
return -1;
}
int slsDetectorUsers::setOverflowMode(int value, int detPos) {
if(value >= 0) {
if (value == 1)
detector.setReadOutFlags(slsDetectorDefs::SHOW_OVERFLOW, detPos);
else
detector.setReadOutFlags(slsDetectorDefs::NOOVERFLOW, detPos);
}
int ret = detector.setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS, detPos);
if (ret == -1)
return -1;
return ((ret & slsDetectorDefs::SHOW_OVERFLOW) ? 1 : 0);
int slsDetectorUsers::setOverflowMode(bool value, int detPos) {
/* to be uncommented when moving to Detector.h
detector.setOverFlowMode(value, {detPos});
auto res = detector.getOverFlowMode({detPos});
if (res.equal())
return res.front();*/
return -1;
}
int slsDetectorUsers::setAllTrimbits(int val, int detPos) {

View File

@ -134,7 +134,6 @@ class BinaryFileStatic {
"Period (ns) : %lld\n"
"Gap Pixels Enable : %d\n"
"Quad Enable : %d\n"
"Parallel Flag : %d\n"
"Analog Flag : %d\n"
"Digital Flag : %d\n"
"ADC Mask : %d\n"
@ -174,7 +173,6 @@ class BinaryFileStatic {
(long long int)attr.periodNs,
attr.gapPixelsEnable,
attr.quadEnable,
attr.parallelFlag,
attr.analogFlag,
attr.digitalFlag,
attr.adcmask,

View File

@ -200,7 +200,7 @@ public:
* @param f readout flags
* @returns analog data bytes
*/
virtual int setImageSize(uint32_t a, uint64_t as, uint64_t ds, bool t, slsDetectorDefs::readOutFlags f = slsDetectorDefs::GET_READOUT_FLAGS) {
virtual int setImageSize(uint32_t a, uint64_t as, uint64_t ds, bool t, slsDetectorDefs::readoutMode) {
FILE_LOG(logERROR) << "setImageSize is a generic function that should be overloaded by a derived class";
return 0;
};
@ -576,37 +576,36 @@ public:
* @param f readout flags
* @returns analog data bytes
*/
int setImageSize(uint32_t a, uint64_t as, uint64_t ds, bool t, slsDetectorDefs::readOutFlags f = slsDetectorDefs::GET_READOUT_FLAGS) {
int setImageSize(uint32_t a, uint64_t as, uint64_t ds, bool t, slsDetectorDefs::readoutMode f) {
int nachans = 0, ndchans = 0;
int adatabytes = 0, ddatabytes = 0;
if (f != slsDetectorDefs::GET_READOUT_FLAGS) {
// analog channels (normal, analog/digital readout)
if (f == slsDetectorDefs::NORMAL_READOUT ||
f & slsDetectorDefs::ANALOG_AND_DIGITAL) {
if (a == BIT32_MASK) {
nachans = 32;
} else {
for (int ich = 0; ich < 32; ++ich) {
if (a & (1 << ich))
++nachans;
}
}
adatabytes = nachans * NUM_BYTES_PER_ANALOG_CHANNEL * as;
FILE_LOG(logDEBUG1) << " Number of Analog Channels:" << nachans
<< " Databytes: " << adatabytes;
}
// digital channels
if (f & slsDetectorDefs::DIGITAL_ONLY ||
f & slsDetectorDefs::ANALOG_AND_DIGITAL) {
ndchans = NCHAN_DIGITAL;
ddatabytes = (sizeof(uint64_t) * ds);
FILE_LOG(logDEBUG1) << "Number of Digital Channels:" << ndchans
<< " Databytes: " << ddatabytes;
}
FILE_LOG(logDEBUG1) << "Total Number of Channels:" << nachans + ndchans
<< " Databytes: " << adatabytes + ddatabytes;
}
// analog channels (normal, analog/digital readout)
if (f == slsDetectorDefs::ANALOG_ONLY ||
f == slsDetectorDefs::ANALOG_AND_DIGITAL) {
if (a == BIT32_MASK) {
nachans = 32;
} else {
for (int ich = 0; ich < 32; ++ich) {
if (a & (1 << ich))
++nachans;
}
}
adatabytes = nachans * NUM_BYTES_PER_ANALOG_CHANNEL * as;
FILE_LOG(logDEBUG1) << " Number of Analog Channels:" << nachans
<< " Databytes: " << adatabytes;
}
// digital channels
if (f == slsDetectorDefs::DIGITAL_ONLY ||
f == slsDetectorDefs::ANALOG_AND_DIGITAL) {
ndchans = NCHAN_DIGITAL;
ddatabytes = (sizeof(uint64_t) * ds);
FILE_LOG(logDEBUG1) << "Number of Digital Channels:" << ndchans
<< " Databytes: " << ddatabytes;
}
FILE_LOG(logDEBUG1) << "Total Number of Channels:" << nachans + ndchans
<< " Databytes: " << adatabytes + ddatabytes;
nPixelsX = nachans + ndchans;
nPixelsY = 1;
// 10G
@ -692,7 +691,7 @@ public:
* @param f readout flags
* @returns analog data bytes
*/
int setImageSize(uint32_t a, uint64_t as, uint64_t ds, bool t, slsDetectorDefs::readOutFlags f = slsDetectorDefs::GET_READOUT_FLAGS) {
int setImageSize(uint32_t a, uint64_t as, uint64_t ds, bool t, slsDetectorDefs::readoutMode) {
int nachans = 0;
int adatabytes = 0;

View File

@ -407,10 +407,6 @@ public:
dataset = group5.createDataSet ( "quad enable", PredType::NATIVE_INT, dataspace );
dataset.write ( &(attr.quadEnable), PredType::NATIVE_INT);
//Parallel Flag
dataset = group5.createDataSet ( "parallel flag", PredType::NATIVE_INT, dataspace );
dataset.write ( &(attr.gapPixelsEnable), PredType::NATIVE_INT);
//Analog Flag
dataset = group5.createDataSet ( "analog flag", PredType::NATIVE_INT, dataspace );
dataset.write ( &(attr.quadEnable), PredType::NATIVE_INT);

View File

@ -65,7 +65,6 @@ struct masterAttributes {
uint64_t periodNs;
uint32_t gapPixelsEnable;
uint32_t quadEnable;
uint32_t parallelFlag;
uint32_t analogFlag;
uint32_t digitalFlag;
uint32_t adcmask;

View File

@ -88,10 +88,10 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
int getReadNLines() const;
/**
* Get readout flags (Eiger, chiptestboard, moench)
* @return readout flags
* Get readout mode (chiptestboard)
* @return readout mode
*/
readOutFlags getReadOutFlags() const;
readoutMode getReadoutMode() const;
//***file parameters***
/**
@ -417,11 +417,11 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
void setReadNLines(const int value);
/**
* Set readout flags (eiger, chiptestboard, moench)
* @param f readout flag
* Set readout mode (chiptestboard)
* @param f readout mode
* @return OK or FAIL
*/
int setReadOutFlags(const readOutFlags f);
int setReadoutMode(const readoutMode f);
//***file parameters***
/**
@ -902,8 +902,8 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
bool quadEnable;
/** num lines readout */
int numLinesReadout;
/** readout flags*/
readOutFlags readoutFlags;
/** readout mode*/
readoutMode readoutType;
//*** receiver parameters ***
/** Number of Threads */

View File

@ -279,8 +279,8 @@ class slsReceiverTCPIPInterface : private virtual slsDetectorDefs {
/** set deactivated receiver padding enable */
int set_deactivated_padding_enable(sls::ServerInterface2 &socket);
/** set readout flags */
int set_readout_flags(sls::ServerInterface2 &socket);
/** set readout mode */
int set_readout_mode(sls::ServerInterface2 &socket);
/** set adc mask */
int set_adc_mask(sls::ServerInterface2 &socket);

View File

@ -71,7 +71,7 @@ void slsReceiverImplementation::InitializeMembers() {
gapPixelsEnable = false;
quadEnable = false;
numLinesReadout = MAX_EIGER_ROWS_PER_READOUT;
readoutFlags = GET_READOUT_FLAGS;
readoutType = ANALOG_ONLY;
//*** receiver parameters ***
numThreads = 1;
@ -168,10 +168,10 @@ int slsReceiverImplementation::getReadNLines() const {
return numLinesReadout;
}
slsDetectorDefs::readOutFlags
slsReceiverImplementation::getReadOutFlags() const {
slsDetectorDefs::readoutMode
slsReceiverImplementation::getReadoutMode() const {
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
return readoutFlags;
return readoutType;
}
/***file parameters***/
@ -546,48 +546,23 @@ void slsReceiverImplementation::setReadNLines(const int value) {
FILE_LOG(logINFO) << "Number of Lines to readout: " << numLinesReadout;
}
int slsReceiverImplementation::setReadOutFlags(const readOutFlags f) {
if (readoutFlags != f) {
readoutFlags = f;
int slsReceiverImplementation::setReadoutMode(const readoutMode f) {
if (readoutType != f) {
readoutType = f;
// side effects
if (myDetectorType == CHIPTESTBOARD) {
ctbAnalogDataBytes = generalData->setImageSize(
adcEnableMask, numberOfAnalogSamples, numberOfDigitalSamples,
tengigaEnable, readoutFlags);
for (const auto &it : dataProcessor)
it->SetPixelDimension();
if (SetupFifoStructure() == FAIL)
return FAIL;
}
ctbAnalogDataBytes = generalData->setImageSize(
adcEnableMask, numberOfAnalogSamples, numberOfDigitalSamples,
tengigaEnable, readoutType);
for (const auto &it : dataProcessor)
it->SetPixelDimension();
if (SetupFifoStructure() == FAIL)
return FAIL;
}
std::string flag;
if (f == NORMAL_READOUT)
flag = "normal(analog, no digital)";
else if (f & STORE_IN_RAM)
flag.append("storeinram ");
if (f & TOT_MODE)
flag.append("tot ");
if (f & CONTINOUS_RO)
flag.append("continous ");
if (f & PARALLEL)
flag.append("parallel ");
if (f & NONPARALLEL)
flag.append("nonparallel ");
if (f & DIGITAL_ONLY)
flag.append("digital ");
if (f & ANALOG_AND_DIGITAL)
flag.append("analog_digital ");
if (f & SHOW_OVERFLOW)
flag.append("overflow ");
if (f & NOOVERFLOW)
flag.append("nooverflow ");
FILE_LOG(logINFO) << "ReadoutFlags: " << flag;
if (myDetectorType == CHIPTESTBOARD) {
FILE_LOG(logINFO) << "Packets per Frame: "
FILE_LOG(logINFO) << "Readout Mode: " << getReadoutModeType(f);
FILE_LOG(logINFO) << "Packets per Frame: "
<< (generalData->packetsPerFrame);
}
return OK;
}
@ -874,19 +849,9 @@ int slsReceiverImplementation::setADCEnableMask(uint32_t mask) {
if (adcEnableMask != mask) {
adcEnableMask = mask;
switch (myDetectorType) {
case MOENCH:
generalData->setImageSize(mask, numberOfAnalogSamples,
numberOfDigitalSamples, tengigaEnable);
break;
case CHIPTESTBOARD:
ctbAnalogDataBytes = generalData->setImageSize(
mask, numberOfAnalogSamples, numberOfDigitalSamples,
tengigaEnable, readoutFlags);
break;
default:
break;
}
ctbAnalogDataBytes = generalData->setImageSize(
mask, numberOfAnalogSamples, numberOfDigitalSamples,
tengigaEnable, readoutType);
for (const auto &it : dataProcessor)
it->SetPixelDimension();
@ -1018,14 +983,10 @@ int slsReceiverImplementation::setNumberofAnalogSamples(const uint64_t i) {
if (numberOfAnalogSamples != i) {
numberOfAnalogSamples = i;
if (myDetectorType == MOENCH) {
generalData->setImageSize(adcEnableMask, numberOfAnalogSamples,
numberOfDigitalSamples, tengigaEnable);
} else if (myDetectorType == CHIPTESTBOARD) {
ctbAnalogDataBytes = generalData->setImageSize(
adcEnableMask, numberOfAnalogSamples, numberOfDigitalSamples,
tengigaEnable, readoutFlags);
}
ctbAnalogDataBytes = generalData->setImageSize(
adcEnableMask, numberOfAnalogSamples, numberOfDigitalSamples,
tengigaEnable, readoutType);
for (const auto &it : dataProcessor)
it->SetPixelDimension();
if (SetupFifoStructure() == FAIL)
@ -1041,14 +1002,10 @@ int slsReceiverImplementation::setNumberofDigitalSamples(const uint64_t i) {
if (numberOfDigitalSamples != i) {
numberOfDigitalSamples = i;
if (myDetectorType == MOENCH) {
generalData->setImageSize(adcEnableMask, numberOfAnalogSamples,
numberOfDigitalSamples, tengigaEnable);
} else if (myDetectorType == CHIPTESTBOARD) {
ctbAnalogDataBytes = generalData->setImageSize(
adcEnableMask, numberOfAnalogSamples, numberOfDigitalSamples,
tengigaEnable, readoutFlags);
}
ctbAnalogDataBytes = generalData->setImageSize(
adcEnableMask, numberOfAnalogSamples, numberOfDigitalSamples,
tengigaEnable, readoutType);
for (const auto &it : dataProcessor)
it->SetPixelDimension();
if (SetupFifoStructure() == FAIL)
@ -1087,13 +1044,10 @@ int slsReceiverImplementation::setTenGigaEnable(const bool b) {
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange, quadEnable);
break;
case MOENCH:
generalData->setImageSize(adcEnableMask, numberOfAnalogSamples,
numberOfDigitalSamples, tengigaEnable);
break;
case CHIPTESTBOARD:
ctbAnalogDataBytes = generalData->setImageSize(
adcEnableMask, numberOfAnalogSamples, numberOfDigitalSamples,
tengigaEnable, readoutFlags);
tengigaEnable, readoutType);
break;
default:
break;
@ -1653,9 +1607,8 @@ int slsReceiverImplementation::SetupWriter() {
attr.periodNs = acquisitionPeriod;
attr.gapPixelsEnable = gapPixelsEnable;
attr.quadEnable = quadEnable;
attr.parallelFlag = (readoutFlags & PARALLEL) ? 1 : 0;
attr.analogFlag = (readoutFlags == NORMAL_READOUT || readoutFlags & ANALOG_AND_DIGITAL) ? 1 : 0;
attr.digitalFlag = (readoutFlags & DIGITAL_ONLY || readoutFlags & ANALOG_AND_DIGITAL) ? 1 : 0;
attr.analogFlag = (readoutType == ANALOG_ONLY || readoutType == ANALOG_AND_DIGITAL) ? 1 : 0;
attr.digitalFlag = (readoutType == DIGITAL_ONLY || readoutType == ANALOG_AND_DIGITAL) ? 1 : 0;
attr.adcmask = adcEnableMask;
attr.dbitoffset = ctbDbitOffset;
attr.dbitlist = 0;

View File

@ -195,7 +195,7 @@ int slsReceiverTCPIPInterface::function_table(){
flist[F_RECEIVER_DISCARD_POLICY] = &slsReceiverTCPIPInterface::set_discard_policy;
flist[F_RECEIVER_PADDING_ENABLE] = &slsReceiverTCPIPInterface::set_padding_enable;
flist[F_RECEIVER_DEACTIVATED_PADDING_ENABLE] = &slsReceiverTCPIPInterface::set_deactivated_padding_enable;
flist[F_RECEIVER_SET_READOUT_FLAGS] = &slsReceiverTCPIPInterface::set_readout_flags;
flist[F_RECEIVER_SET_READOUT_MODE] = &slsReceiverTCPIPInterface::set_readout_mode;
flist[F_RECEIVER_SET_ADC_MASK] = &slsReceiverTCPIPInterface::set_adc_mask;
flist[F_SET_RECEIVER_DBIT_LIST] = &slsReceiverTCPIPInterface::set_dbit_list;
flist[F_GET_RECEIVER_DBIT_LIST] = &slsReceiverTCPIPInterface::get_dbit_list;
@ -1230,22 +1230,21 @@ int slsReceiverTCPIPInterface::set_deactivated_padding_enable(
return socket.sendResult(retval);
}
int slsReceiverTCPIPInterface::set_readout_flags(Interface &socket) {
auto arg = socket.Receive<readOutFlags>();
int slsReceiverTCPIPInterface::set_readout_mode(Interface &socket) {
auto arg = socket.Receive<readoutMode>();
if (myDetectorType == JUNGFRAU || myDetectorType == GOTTHARD ||
myDetectorType == MOENCH)
if (myDetectorType != CHIPTESTBOARD)
functionNotImplemented();
if (arg >= 0) {
VerifyIdle(socket);
FILE_LOG(logDEBUG1) << "Setting readout flag: " << arg;
impl()->setReadOutFlags(arg);
FILE_LOG(logDEBUG1) << "Setting readout mode: " << arg;
impl()->setReadoutMode(arg);
}
auto retval = impl()->getReadOutFlags();
validate(static_cast<int>(arg), static_cast<int>(retval & arg),
"set readout flags", HEX);
FILE_LOG(logDEBUG1) << "Readout flags: " << retval;
auto retval = impl()->getReadoutMode();
validate(static_cast<int>(arg), static_cast<int>(retval),
"set readout mode", DEC);
FILE_LOG(logDEBUG1) << "Readout mode: " << retval;
return socket.sendResult(retval);
}

View File

@ -499,36 +499,23 @@ format
DBIT_PIPELINE, /**< adc pipeline */
MAX_ADC_PHASE_SHIFT, /** max adc phase shift */
MAX_DBIT_PHASE_SHIFT, /** max adc phase shift */
SYNC_CLOCK,
SYNC_CLOCK
};
/**
readout flags
*/
enum readOutFlags {
GET_READOUT_FLAGS = -1, /**< return readout flags */
NORMAL_READOUT = 0, /**< no flag */
STORE_IN_RAM = 0x1, /**< data are stored in ram and sent only after end
of acquisition for faster frame rate */
READ_HITS = 0x2, /**< return only the number of the channel which
counted ate least one */
ZERO_COMPRESSION = 0x4, /**< returned data are 0-compressed */
PUMP_PROBE_MODE = 0x8, /**<pump-probe mode */
BACKGROUND_CORRECTIONS = 0x1000, /**<background corrections */
TOT_MODE = 0x2000, /**< pump-probe mode */
CONTINOUS_RO = 0x4000, /**< pump-probe mode */
PARALLEL = 0x10000, /**< eiger parallel mode */
NONPARALLEL = 0x20000, /**< eiger serial mode */
DIGITAL_ONLY = 0x80000, /** chiptest board read only digital bits (not
adc values)*/
ANALOG_AND_DIGITAL = 0x100000, /** chiptest board read adc values and
digital bits digital bits */
DUT_CLK = 0x200000, /** chiptest board fifo clock comes from device
under test */
SHOW_OVERFLOW = 0x400000, /** eiger 32 bit mode, show saturated for
overflow of single subframes */
NOOVERFLOW = 0x800000 /** eiger 32 bit mode, do not show saturated for
overflow of single subframes */
* read out mode (ctb, moench)
*/
enum readoutMode {
ANALOG_ONLY,
DIGITAL_ONLY,
ANALOG_AND_DIGITAL
};
/** chip speed */
enum speedLevel {
FULL_SPEED,
HALF_SPEED,
QUARTER_SPEED
};
/** port type */
@ -900,6 +887,56 @@ format
}
};
/** returns string from readoutMode */
static std::string getReadoutModeType(readoutMode mode) {
switch(mode) {
case ANALOG_ONLY:
return "analog";
case DIGITAL_ONLY:
return "digital";
case ANALOG_AND_DIGITAL:
return "analog_digital";
default:
return "Unknown";
}
};
/** returns readoutMode from string */
static readoutMode getReadoutModeType(std::string smode) {
if (smode == "analog")
return ANALOG_ONLY;
if (smode == "digital")
return DIGITAL_ONLY;
if (smode == "analog_digital")
return ANALOG_AND_DIGITAL;
throw sls::RuntimeError("Unknown readout mode " + smode);
};
/** returns string from speedLevel */
static std::string getSpeedLevelType(speedLevel mode) {
switch(mode) {
case FULL_SPEED:
return "full_speed";
case HALF_SPEED:
return "half_speed";
case QUARTER_SPEED:
return "quarter_speed";
default:
return "Unknown";
}
};
/** returns speedLevel from string */
static speedLevel getSpeedLevelType(std::string smode) {
if (smode == "full_speed")
return FULL_SPEED;
if (smode == "half_speed")
return HALF_SPEED;
if (smode == "quarter_speed")
return QUARTER_SPEED;
throw sls::RuntimeError("Unknown speed level mode " + smode);
};
/**
@short returns adc index from std::string
\param s can be temp_fpga, temp_fpgaext, temp_10ge, temp_dcdc, temp_sodl,

View File

@ -33,7 +33,6 @@ enum detFuncs{
F_SET_TIMER, /**< set/get timer value */
F_GET_TIME_LEFT, /**< get current value of the timer (time left) */
F_SET_DYNAMIC_RANGE, /**< set/get detector dynamic range */
F_SET_READOUT_FLAGS, /**< set/get readout flags */
F_SET_ROI, /**< set/get region of interest */
F_GET_ROI,
F_SET_SPEED, /**< set/get readout speed parameters */
@ -93,6 +92,14 @@ enum detFuncs{
F_GET_INTERRUPT_SUBFRAME,
F_SET_READ_N_LINES,
F_GET_READ_N_LINES,
F_SET_PARALLEL_MODE,
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,
NUM_DET_FUNCTIONS,
RECEIVER_ENUM_START = 128, /**< detector function should not exceed this (detector server should not compile anyway) */
@ -145,7 +152,7 @@ enum detFuncs{
F_RECEIVER_DISCARD_POLICY, /** < frames discard policy */
F_RECEIVER_PADDING_ENABLE, /** < partial frames padding enable */
F_RECEIVER_DEACTIVATED_PADDING_ENABLE, /** < deactivated receiver padding enable */
F_RECEIVER_SET_READOUT_FLAGS, /**< set/get receiver readout flags */
F_RECEIVER_SET_READOUT_MODE, /**< set/get receiver readout mode */
F_RECEIVER_SET_ADC_MASK, /**< set adc mask */
F_SET_RECEIVER_DBIT_LIST, /** < set receiver digital bit list */
F_GET_RECEIVER_DBIT_LIST, /** < get receiver digital bit list */
@ -181,7 +188,6 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_TIMER: return "F_SET_TIMER";
case F_GET_TIME_LEFT: return "F_GET_TIME_LEFT";
case F_SET_DYNAMIC_RANGE: return "F_SET_DYNAMIC_RANGE";
case F_SET_READOUT_FLAGS: return "F_SET_READOUT_FLAGS";
case F_SET_ROI: return "F_SET_ROI";
case F_GET_ROI: return "F_GET_ROI";
case F_SET_SPEED: return "F_SET_SPEED";
@ -241,6 +247,14 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_GET_INTERRUPT_SUBFRAME: return "F_GET_INTERRUPT_SUBFRAME";
case F_SET_READ_N_LINES: return "F_SET_READ_N_LINES";
case F_GET_READ_N_LINES: return "F_GET_READ_N_LINES";
case F_SET_PARALLEL_MODE: return "F_SET_PARALLEL_MODE";
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 NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
@ -293,7 +307,7 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_RECEIVER_DISCARD_POLICY: return "F_RECEIVER_DISCARD_POLICY";
case F_RECEIVER_PADDING_ENABLE: return "F_RECEIVER_PADDING_ENABLE";
case F_RECEIVER_DEACTIVATED_PADDING_ENABLE: return "F_RECEIVER_DEACTIVATED_PADDING_ENABLE";
case F_RECEIVER_SET_READOUT_FLAGS: return "F_RECEIVER_SET_READOUT_FLAGS";
case F_RECEIVER_SET_READOUT_MODE: return "F_RECEIVER_SET_READOUT_MODE";
case F_RECEIVER_SET_ADC_MASK: return "F_RECEIVER_SET_ADC_MASK";
case F_SET_RECEIVER_DBIT_LIST: return "F_SET_RECEIVER_DBIT_LIST";
case F_GET_RECEIVER_DBIT_LIST: return "F_GET_RECEIVER_DBIT_LIST";

View File

@ -4,9 +4,9 @@
#define APIRECEIVER 0x190722
#define APIGUI 0x190723
#define APIMOENCH 0x190820
#define APICTB 0x190830
#define APIGOTTHARD 0x190830
#define APIJUNGFRAU 0x190830
#define APIMYTHEN3 0x190830
#define APIEIGER 0x190830
#define APIGOTTHARD2 0x190902
#define APIEIGER 0x190902
#define APIJUNGFRAU 0x190902
#define APICTB 0x190902

View File

@ -17,18 +17,24 @@ cd $API_DIR
NUM=$(sed -n '/'$API_NAME' /=' $API_FILE)
#echo $NUM
if [ "$NUM" -gt 0 ]; then
sed -i ${NUM}d $API_FILE
fi
#find new API date
API_DATE="find . -printf \"%T@ %CY-%Cm-%CdT%CH:%CM:%CS %p\n\"| sort -nr | cut -d' ' -f2- | egrep -v build | egrep -v '(\.)o'| egrep -v 'versionAPI.h' | head -n 1"
API_DATE="find . -printf \"%T@ %CY-%Cm-%Cd\n\"| sort -nr | cut -d' ' -f2- | egrep -v '(\.)o' | head -n 1"
API_DATE=`eval $API_DATE`
API_DATE=$(sed "s/-//g" <<< $API_DATE | awk '{print $1;}' )
#extracting only date
API_DATE=${API_DATE:2:6}
#prefix of 0x
API_DATE=${API_DATE/#/0x}
echo "date="$API_DATE
#copy it to versionAPI.h
echo "#define "$API_NAME $API_DATE >> $API_FILE