mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
set starting frame number of next acquisition for both jungfrau and e… (#27)
* set starting frame number of next acquisition for both jungfrau and eiger. firmware has not implemented a get, so workaround. tests included. frame number 0 not allowed due to Eiger. Eiger max frame is 48 bit, while jungfrau is 64 bit * made argument of setstartingframenumber const
This commit is contained in:
parent
894cc1c9e0
commit
29141ac1a6
17
cmk.sh
17
cmk.sh
@ -8,6 +8,7 @@ RECEIVER=0
|
|||||||
GUI=0
|
GUI=0
|
||||||
DEBUG=0
|
DEBUG=0
|
||||||
PYTHON=0
|
PYTHON=0
|
||||||
|
TESTS=0
|
||||||
SIMULATOR=0
|
SIMULATOR=0
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ CMAKE_PRE=""
|
|||||||
CMAKE_POST=""
|
CMAKE_POST=""
|
||||||
|
|
||||||
usage() { echo -e "
|
usage() { echo -e "
|
||||||
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
|
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
|
||||||
-[no option]: only make
|
-[no option]: only make
|
||||||
-c: Clean
|
-c: Clean
|
||||||
-b: Builds/Rebuilds CMake files normal mode
|
-b: Builds/Rebuilds CMake files normal mode
|
||||||
@ -30,6 +31,7 @@ Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [-h] [-d <HDF5 directory>] [-j] <Nu
|
|||||||
-s: Simulator
|
-s: Simulator
|
||||||
-j: Number of threads to compile through
|
-j: Number of threads to compile through
|
||||||
-e: Debug mode
|
-e: Debug mode
|
||||||
|
-i: Builds tests
|
||||||
|
|
||||||
Rebuild when you switch to a new build and compile in parallel:
|
Rebuild when you switch to a new build and compile in parallel:
|
||||||
./cmk.sh -bj5
|
./cmk.sh -bj5
|
||||||
@ -65,7 +67,7 @@ For rebuilding only certain sections
|
|||||||
|
|
||||||
" ; exit 1; }
|
" ; exit 1; }
|
||||||
|
|
||||||
while getopts ":bpchd:j:trges" opt ; do
|
while getopts ":bpchd:j:trgeis" opt ; do
|
||||||
case $opt in
|
case $opt in
|
||||||
b)
|
b)
|
||||||
echo "Building of CMake files Required"
|
echo "Building of CMake files Required"
|
||||||
@ -112,6 +114,10 @@ while getopts ":bpchd:j:trges" opt ; do
|
|||||||
echo "Compiling Options: Debug"
|
echo "Compiling Options: Debug"
|
||||||
DEBUG=1
|
DEBUG=1
|
||||||
;;
|
;;
|
||||||
|
i)
|
||||||
|
echo "Compiling Options: Tests"
|
||||||
|
TESTS=1
|
||||||
|
;;
|
||||||
s)
|
s)
|
||||||
echo "Compiling Options: Simulator"
|
echo "Compiling Options: Simulator"
|
||||||
SIMULATOR=1
|
SIMULATOR=1
|
||||||
@ -186,6 +192,13 @@ if [ $SIMULATOR -eq 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#Tests
|
||||||
|
if [ $TESTS -eq 1 ]; then
|
||||||
|
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_TESTS=ON -DSLS_USE_INTEGRATION_TESTS=ON"
|
||||||
|
echo "Tests Option enabled"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
#hdf5 rebuild
|
#hdf5 rebuild
|
||||||
if [ $HDF5 -eq 1 ]; then
|
if [ $HDF5 -eq 1 ]; then
|
||||||
# CMAKE_PRE+="HDF5_ROOT="$HDF5DIR
|
# CMAKE_PRE+="HDF5_ROOT="$HDF5DIR
|
||||||
|
@ -480,3 +480,41 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert", "[.ctbintegrat
|
|||||||
CHECK(m.readRegister(0x7b) == 0x1003E);
|
CHECK(m.readRegister(0x7b) == 0x1003E);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Eiger or Jungfrau startingfnum", "[.eigerintegration][.jungfrauintegration][startingfnum]") {
|
||||||
|
SingleDetectorConfig c;
|
||||||
|
|
||||||
|
// pick up multi detector from shm id 0
|
||||||
|
multiSlsDetector m(0);
|
||||||
|
|
||||||
|
// ensure ctb detector type, hostname and online
|
||||||
|
REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU)));
|
||||||
|
REQUIRE(m.getHostname() == c.hostname);
|
||||||
|
REQUIRE(m.setOnline(true) == slsDetectorDefs::ONLINE_FLAG);
|
||||||
|
|
||||||
|
CHECK(m.setTimer(slsDetectorDefs::FRAME_NUMBER, 1) == 1);
|
||||||
|
|
||||||
|
// starting fnum
|
||||||
|
uint64_t val = 8;
|
||||||
|
|
||||||
|
m.setStartingFrameNumber(val);
|
||||||
|
CHECK(m.getStartingFrameNumber() == val);
|
||||||
|
CHECK(m.acquire() == slsDetectorDefs::OK);
|
||||||
|
CHECK(m.getReceiverCurrentFrameIndex() == val);
|
||||||
|
|
||||||
|
++val;
|
||||||
|
CHECK(m.acquire() == slsDetectorDefs::OK);
|
||||||
|
CHECK(m.getReceiverCurrentFrameIndex() == val);
|
||||||
|
|
||||||
|
CHECK_THROWS_AS(m.setStartingFrameNumber(0), sls::RuntimeError);
|
||||||
|
|
||||||
|
if (m.getDetectorTypeAsString() == "Eiger") {
|
||||||
|
val = 281474976710655;
|
||||||
|
} else if (m.getDetectorTypeAsString() == "Jungfrau") {
|
||||||
|
val = 18446744073709551615;
|
||||||
|
}
|
||||||
|
m.setStartingFrameNumber(val);
|
||||||
|
CHECK(m.getStartingFrameNumber() == val);
|
||||||
|
CHECK(m.acquire() == slsDetectorDefs::OK);
|
||||||
|
CHECK(m.getReceiverCurrentFrameIndex() == val);
|
||||||
|
}
|
@ -36,6 +36,7 @@ int Beb_activated = 1;
|
|||||||
uint32_t Beb_detid = 0;
|
uint32_t Beb_detid = 0;
|
||||||
int Beb_top =0;
|
int Beb_top =0;
|
||||||
|
|
||||||
|
uint64_t Beb_deactivatedStartFrameNumber = 0;
|
||||||
|
|
||||||
|
|
||||||
void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num) {
|
void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num) {
|
||||||
@ -409,6 +410,10 @@ int Beb_Activate(int enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Beb_GetActivate() {
|
||||||
|
return Beb_activated;
|
||||||
|
}
|
||||||
|
|
||||||
int Beb_Set32bitOverflow(int val) {
|
int Beb_Set32bitOverflow(int val) {
|
||||||
if (!Beb_activated)
|
if (!Beb_activated)
|
||||||
return val;
|
return val;
|
||||||
@ -1262,6 +1267,62 @@ int Beb_SetDetectorPosition(int pos[]) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Beb_SetStartingFrameNumber(uint64_t value) {
|
||||||
|
if (!Beb_activated) {
|
||||||
|
Beb_deactivatedStartFrameNumber = value;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
FILE_LOG(logINFO, ("Setting start frame number: %llu\n", (long long unsigned int)value));
|
||||||
|
|
||||||
|
u_int32_t* csp0base = 0;
|
||||||
|
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_TEST_BASEADDR);
|
||||||
|
if (fd < 0) {
|
||||||
|
FILE_LOG(logERROR, ("Set Start Frame Number FAIL\n"));
|
||||||
|
return FAIL;
|
||||||
|
} else {
|
||||||
|
// since the read is not implemented in firmware yet
|
||||||
|
Beb_deactivatedStartFrameNumber = value;
|
||||||
|
|
||||||
|
// decrement for firmware
|
||||||
|
uint64_t valueInFirmware = value - 1;
|
||||||
|
Beb_Write32(csp0base, UDP_HEADER_FRAME_NUMBER_LSB_OFST, valueInFirmware & (0xffffffff));
|
||||||
|
Beb_Write32(csp0base, UDP_HEADER_FRAME_NUMBER_MSB_OFST, (valueInFirmware >> 32) & (0xffffffff));
|
||||||
|
Beb_close(fd,csp0base);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t retval = -1;
|
||||||
|
if ((Beb_GetStartingFrameNumber(&retval) == OK) && (retval == value)) {
|
||||||
|
FILE_LOG(logINFO, ("Going to reset Frame Number\n"));
|
||||||
|
Beb_ResetFrameNumber();
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Beb_GetStartingFrameNumber(uint64_t* retval) {
|
||||||
|
if (!Beb_activated) {
|
||||||
|
*retval = Beb_deactivatedStartFrameNumber;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
FILE_LOG(logDEBUG1, ("Getting start frame number\n"));
|
||||||
|
|
||||||
|
// since it is not implemented in firmware yet
|
||||||
|
*retval = Beb_deactivatedStartFrameNumber;
|
||||||
|
/*
|
||||||
|
u_int32_t* csp0base = 0;
|
||||||
|
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_TEST_BASEADDR);
|
||||||
|
if (fd < 0) {
|
||||||
|
FILE_LOG(logERROR, ("Set Start Frame Number FAIL\n"));
|
||||||
|
return FAIL;
|
||||||
|
} else {
|
||||||
|
*retval = Beb_Read32(csp0base, UDP_HEADER_FRAME_NUMBER_MSB_OFST);
|
||||||
|
uint32_t lretval = Beb_Read32(csp0base, UDP_HEADER_FRAME_NUMBER_MSB_OFST);
|
||||||
|
*retval = (*retval << 32) | lretval;
|
||||||
|
Beb_close(fd,csp0base);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint16_t Beb_swap_uint16( uint16_t val) {
|
uint16_t Beb_swap_uint16( uint16_t val) {
|
||||||
return (val << 8) | (val >> 8 );
|
return (val << 8) | (val >> 8 );
|
||||||
|
@ -39,6 +39,7 @@ void Beb_EndofDataSend(int tengiga);
|
|||||||
int Beb_SetMasterViaSoftware();
|
int Beb_SetMasterViaSoftware();
|
||||||
int Beb_SetSlaveViaSoftware();
|
int Beb_SetSlaveViaSoftware();
|
||||||
int Beb_Activate(int enable);
|
int Beb_Activate(int enable);
|
||||||
|
int Beb_GetActivate();
|
||||||
int Beb_Set32bitOverflow(int val);
|
int Beb_Set32bitOverflow(int val);
|
||||||
int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val);
|
int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val);
|
||||||
int Beb_ResetToHardwareSettings();
|
int Beb_ResetToHardwareSettings();
|
||||||
@ -74,6 +75,8 @@ int Beb_GetBebFPGATemp();
|
|||||||
|
|
||||||
void Beb_SetDetectorNumber(uint32_t detid);
|
void Beb_SetDetectorNumber(uint32_t detid);
|
||||||
int Beb_SetDetectorPosition(int pos[]);
|
int Beb_SetDetectorPosition(int pos[]);
|
||||||
|
int Beb_SetStartingFrameNumber(uint64_t value);
|
||||||
|
int Beb_GetStartingFrameNumber(uint64_t* retval);
|
||||||
|
|
||||||
uint16_t Beb_swap_uint16( uint16_t val);
|
uint16_t Beb_swap_uint16( uint16_t val);
|
||||||
int Beb_open(u_int32_t** csp0base, u_int32_t offset);
|
int Beb_open(u_int32_t** csp0base, u_int32_t offset);
|
||||||
|
@ -202,8 +202,9 @@
|
|||||||
#define UDP_HEADER_Y_OFST (16)
|
#define UDP_HEADER_Y_OFST (16)
|
||||||
#define UDP_HEADER_Y_MSK (0xFFFF << UDP_HEADER_Y_OFST)
|
#define UDP_HEADER_Y_MSK (0xFFFF << UDP_HEADER_Y_OFST)
|
||||||
|
|
||||||
|
// udp header (frame number)
|
||||||
|
#define UDP_HEADER_FRAME_NUMBER_LSB_OFST (0x0140)
|
||||||
|
#define UDP_HEADER_FRAME_NUMBER_MSB_OFST (0x0160)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ int eiger_virtual_status=0;
|
|||||||
int eiger_virtual_activate=1;
|
int eiger_virtual_activate=1;
|
||||||
pthread_t eiger_virtual_tid;
|
pthread_t eiger_virtual_tid;
|
||||||
int eiger_virtual_stop = 0;
|
int eiger_virtual_stop = 0;
|
||||||
|
uint64_t eiger_virtual_startingframenumber = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -444,6 +445,7 @@ void setupDetector() {
|
|||||||
setSpeed(CLOCK_DIVIDER, DEFAULT_CLK_SPEED);//clk_devider,half speed
|
setSpeed(CLOCK_DIVIDER, DEFAULT_CLK_SPEED);//clk_devider,half speed
|
||||||
setIODelay(DEFAULT_IO_DELAY);
|
setIODelay(DEFAULT_IO_DELAY);
|
||||||
setTiming(DEFAULT_TIMING_MODE);
|
setTiming(DEFAULT_TIMING_MODE);
|
||||||
|
setStartingFrameNumber(DEFAULT_STARTING_FRAME_NUMBER);
|
||||||
//SetPhotonEnergyCalibrationParameters(-5.8381e-5,1.838515,5.09948e-7,-4.32390e-11,1.32527e-15);
|
//SetPhotonEnergyCalibrationParameters(-5.8381e-5,1.838515,5.09948e-7,-4.32390e-11,1.32527e-15);
|
||||||
setRateCorrection(DEFAULT_RATE_CORRECTION);
|
setRateCorrection(DEFAULT_RATE_CORRECTION);
|
||||||
int enable[2] = {DEFAULT_EXT_GATING_ENABLE, DEFAULT_EXT_GATING_POLARITY};
|
int enable[2] = {DEFAULT_EXT_GATING_ENABLE, DEFAULT_EXT_GATING_POLARITY};
|
||||||
@ -658,6 +660,24 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val) {
|
|||||||
|
|
||||||
/* parameters - timer */
|
/* parameters - timer */
|
||||||
|
|
||||||
|
int setStartingFrameNumber(uint64_t value) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
eiger_virtual_startingframenumber = value;
|
||||||
|
return OK;
|
||||||
|
#else
|
||||||
|
return Beb_SetStartingFrameNumber(value);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int getStartingFrameNumber(uint64_t* retval) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
*retval = eiger_virtual_startingframenumber;
|
||||||
|
return OK;
|
||||||
|
#else
|
||||||
|
return Beb_GetStartingFrameNumber(retval);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int64_t setTimer(enum timerIndex ind, int64_t val) {
|
int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
int64_t subdeadtime = 0;
|
int64_t subdeadtime = 0;
|
||||||
@ -1609,8 +1629,6 @@ int prepareAcquisition() {
|
|||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
FILE_LOG(logINFO, ("Going to prepare for acquisition with counter_bit:%d\n",Feb_Control_Get_Counter_Bit()));
|
FILE_LOG(logINFO, ("Going to prepare for acquisition with counter_bit:%d\n",Feb_Control_Get_Counter_Bit()));
|
||||||
Feb_Control_PrepareForAcquisition();
|
Feb_Control_PrepareForAcquisition();
|
||||||
FILE_LOG(logINFO, ("Going to reset Frame Number\n"));
|
|
||||||
Beb_ResetFrameNumber();
|
|
||||||
#endif
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ enum {E_PARALLEL, E_NON_PARALLEL, E_SAFE};
|
|||||||
|
|
||||||
/** Default Parameters */
|
/** Default Parameters */
|
||||||
#define DEFAULT_NUM_FRAMES (1)
|
#define DEFAULT_NUM_FRAMES (1)
|
||||||
|
#define DEFAULT_STARTING_FRAME_NUMBER (1)
|
||||||
#define DEFAULT_NUM_CYCLES (1)
|
#define DEFAULT_NUM_CYCLES (1)
|
||||||
#define DEFAULT_EXPTIME (1E9) //ns
|
#define DEFAULT_EXPTIME (1E9) //ns
|
||||||
#define DEFAULT_PERIOD (1E9) //ns
|
#define DEFAULT_PERIOD (1E9) //ns
|
||||||
@ -74,6 +75,8 @@ enum {E_PARALLEL, E_NON_PARALLEL, E_SAFE};
|
|||||||
#define DEFAULT_TEST_MODE (0)
|
#define DEFAULT_TEST_MODE (0)
|
||||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||||
|
|
||||||
|
#define UDP_HEADER_MAX_FRAME_VALUE (0xFFFFFFFFFFFF)
|
||||||
|
|
||||||
#define DAC_MIN_MV (0)
|
#define DAC_MIN_MV (0)
|
||||||
#define DAC_MAX_MV (2048)
|
#define DAC_MAX_MV (2048)
|
||||||
#define LTC2620_MIN_VAL (0) // including LTC defines instead of LTC262.h (includes bit banging and blackfin read and write)
|
#define LTC2620_MIN_VAL (0) // including LTC defines instead of LTC262.h (includes bit banging and blackfin read and write)
|
||||||
|
@ -388,6 +388,10 @@
|
|||||||
#define SET_EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT)
|
#define SET_EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT)
|
||||||
#define SET_EXPTIME_MSB_REG (0x69 << MEM_MAP_SHIFT)
|
#define SET_EXPTIME_MSB_REG (0x69 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
/* Frame number 64 bit register */
|
||||||
|
#define FRAME_NUMBER_LSB_REG (0x6A << MEM_MAP_SHIFT)
|
||||||
|
#define FRAME_NUMBER_MSB_REG (0x6B << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Trigger Delay 32 bit register */
|
/* Trigger Delay 32 bit register */
|
||||||
#define SET_TRIGGER_DELAY_LSB_REG (0x70 << MEM_MAP_SHIFT)
|
#define SET_TRIGGER_DELAY_LSB_REG (0x70 << MEM_MAP_SHIFT)
|
||||||
#define SET_TRIGGER_DELAY_MSB_REG (0x71 << MEM_MAP_SHIFT)
|
#define SET_TRIGGER_DELAY_MSB_REG (0x71 << MEM_MAP_SHIFT)
|
||||||
|
@ -441,6 +441,7 @@ void setupDetector() {
|
|||||||
selectStoragecellStart(DEFAULT_STRG_CLL_STRT);
|
selectStoragecellStart(DEFAULT_STRG_CLL_STRT);
|
||||||
/*setClockDivider(HALF_SPEED); depends if all the previous stuff works*/
|
/*setClockDivider(HALF_SPEED); depends if all the previous stuff works*/
|
||||||
setTiming(DEFAULT_TIMING_MODE);
|
setTiming(DEFAULT_TIMING_MODE);
|
||||||
|
setStartingFrameNumber(DEFAULT_STARTING_FRAME_NUMBER);
|
||||||
|
|
||||||
|
|
||||||
// temp threshold and reset event
|
// temp threshold and reset event
|
||||||
@ -555,6 +556,20 @@ int selectStoragecellStart(int pos) {
|
|||||||
return ((bus_r(DAQ_REG) & DAQ_STRG_CELL_SLCT_MSK) >> DAQ_STRG_CELL_SLCT_OFST);
|
return ((bus_r(DAQ_REG) & DAQ_STRG_CELL_SLCT_MSK) >> DAQ_STRG_CELL_SLCT_OFST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int setStartingFrameNumber(uint64_t value) {
|
||||||
|
FILE_LOG(logINFO, ("Setting starting frame number: %llu\n",(long long unsigned int)value));
|
||||||
|
// decrement is for firmware
|
||||||
|
setU64BitReg(value - 1, FRAME_NUMBER_LSB_REG, FRAME_NUMBER_MSB_REG);
|
||||||
|
// need to set it twice for the firmware to catch
|
||||||
|
setU64BitReg(value - 1, FRAME_NUMBER_LSB_REG, FRAME_NUMBER_MSB_REG);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getStartingFrameNumber(uint64_t* retval) {
|
||||||
|
// increment is for firmware
|
||||||
|
*retval = (getU64BitReg(FRAME_NUMBER_LSB_REG, FRAME_NUMBER_MSB_REG) + 1);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int64_t setTimer(enum timerIndex ind, int64_t val) {
|
int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||||
|
@ -63,6 +63,7 @@ enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
|
|||||||
|
|
||||||
/** Default Parameters */
|
/** Default Parameters */
|
||||||
#define DEFAULT_NUM_FRAMES (100*1000*1000)
|
#define DEFAULT_NUM_FRAMES (100*1000*1000)
|
||||||
|
#define DEFAULT_STARTING_FRAME_NUMBER (1)
|
||||||
#define DEFAULT_NUM_CYCLES (1)
|
#define DEFAULT_NUM_CYCLES (1)
|
||||||
#define DEFAULT_EXPTIME (10*1000) //ns
|
#define DEFAULT_EXPTIME (10*1000) //ns
|
||||||
#define DEFAULT_PERIOD (2*1000*1000) //ns
|
#define DEFAULT_PERIOD (2*1000*1000) //ns
|
||||||
|
@ -97,6 +97,29 @@ int64_t set64BitReg(int64_t value, int aLSB, int aMSB){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read unsigned 64 bit from a 64 bit register
|
||||||
|
* @param aLSB LSB offset address
|
||||||
|
* @param aMSB MSB offset address
|
||||||
|
* @returns unsigned 64 bit data read
|
||||||
|
*/
|
||||||
|
uint64_t getU64BitReg(int aLSB, int aMSB){
|
||||||
|
uint64_t retval = bus_r(aMSB);
|
||||||
|
retval = (retval << 32) | bus_r(aLSB);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write unsigned 64 bit into a 64 bit register
|
||||||
|
* @param value unsigned 64 bit data
|
||||||
|
* @param aLSB LSB offset address
|
||||||
|
* @param aMSB MSB offset address
|
||||||
|
*/
|
||||||
|
void setU64BitReg(uint64_t value, int aLSB, int aMSB){
|
||||||
|
bus_w(aLSB, value & (0xffffffff));
|
||||||
|
bus_w(aMSB, (value >> 32) & (0xffffffff));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read from a 32 bit register (literal register value provided by client)
|
* Read from a 32 bit register (literal register value provided by client)
|
||||||
* @param offset address offset
|
* @param offset address offset
|
||||||
|
@ -139,6 +139,10 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val);
|
|||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
int selectStoragecellStart(int pos);
|
int selectStoragecellStart(int pos);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||||
|
int setStartingFrameNumber(uint64_t value);
|
||||||
|
int getStartingFrameNumber(uint64_t* value);
|
||||||
|
#endif
|
||||||
int64_t setTimer(enum timerIndex ind, int64_t val);
|
int64_t setTimer(enum timerIndex ind, int64_t val);
|
||||||
int64_t getTimeLeft(enum timerIndex ind);
|
int64_t getTimeLeft(enum timerIndex ind);
|
||||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||||
|
@ -242,6 +242,8 @@ const char* getFunctionName(enum detFuncs func) {
|
|||||||
case F_GET_ADC_INVERT: return "F_GET_ADC_INVERT";
|
case F_GET_ADC_INVERT: return "F_GET_ADC_INVERT";
|
||||||
case F_EXTERNAL_SAMPLING_SOURCE: return "F_EXTERNAL_SAMPLING_SOURCE";
|
case F_EXTERNAL_SAMPLING_SOURCE: return "F_EXTERNAL_SAMPLING_SOURCE";
|
||||||
case F_EXTERNAL_SAMPLING: return "F_EXTERNAL_SAMPLING";
|
case F_EXTERNAL_SAMPLING: return "F_EXTERNAL_SAMPLING";
|
||||||
|
case F_SET_STARTING_FRAME_NUMBER: return "F_SET_STARTING_FRAME_NUMBER";
|
||||||
|
case F_GET_STARTING_FRAME_NUMBER: return "F_GET_STARTING_FRAME_NUMBER";
|
||||||
default: return "Unknown Function";
|
default: return "Unknown Function";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -324,6 +326,8 @@ void function_table() {
|
|||||||
flist[F_GET_ADC_INVERT] = &get_adc_invert;
|
flist[F_GET_ADC_INVERT] = &get_adc_invert;
|
||||||
flist[F_EXTERNAL_SAMPLING_SOURCE] = &set_external_sampling_source;
|
flist[F_EXTERNAL_SAMPLING_SOURCE] = &set_external_sampling_source;
|
||||||
flist[F_EXTERNAL_SAMPLING] = &set_external_sampling;
|
flist[F_EXTERNAL_SAMPLING] = &set_external_sampling;
|
||||||
|
flist[F_SET_STARTING_FRAME_NUMBER] = &set_starting_frame_number;
|
||||||
|
flist[F_GET_STARTING_FRAME_NUMBER] = &get_starting_frame_number;
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||||
@ -3999,3 +4003,79 @@ int set_external_sampling(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int set_starting_frame_number(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
uint64_t arg = 0;
|
||||||
|
|
||||||
|
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
FILE_LOG(logINFO, ("Setting starting frame number to %llu\n", arg));
|
||||||
|
|
||||||
|
#if (!defined(EIGERD)) && (!defined(JUNGFRAUD))
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// only set
|
||||||
|
if (Server_VerifyLock() == OK) {
|
||||||
|
if (arg == 0) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess, "Could not set starting frame number. Cannot be 0.\n");
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
}
|
||||||
|
#ifdef EIGERD
|
||||||
|
else if (arg > UDP_HEADER_MAX_FRAME_VALUE) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess, "Could not set starting frame number. Must be less then %lld (0x%llx)\n", UDP_HEADER_MAX_FRAME_VALUE, UDP_HEADER_MAX_FRAME_VALUE);
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else {
|
||||||
|
ret = setStartingFrameNumber(arg);
|
||||||
|
if (ret == FAIL) {
|
||||||
|
sprintf(mess, "Could not set starting frame number. Failed to map address.\n");
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
}
|
||||||
|
if (ret == OK) {
|
||||||
|
uint64_t retval = 0;
|
||||||
|
ret = getStartingFrameNumber(&retval);
|
||||||
|
if (ret == FAIL) {
|
||||||
|
sprintf(mess, "Could not get starting frame number. Failed to map address.\n");
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
} else {
|
||||||
|
if (arg != retval) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess, "Could not set starting frame number. Set 0x%llx, but read 0x%llx\n", arg, retval);
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_starting_frame_number(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
uint64_t retval = -1;
|
||||||
|
|
||||||
|
FILE_LOG(logDEBUG1, ("Getting Starting frame number \n"));
|
||||||
|
|
||||||
|
#if (!defined(EIGERD)) && (!defined(JUNGFRAUD))
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// get
|
||||||
|
ret = getStartingFrameNumber(&retval);
|
||||||
|
if (ret == FAIL) {
|
||||||
|
sprintf(mess, "Could not get starting frame number. Failed to map address.\n");
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
} else {
|
||||||
|
FILE_LOG(logDEBUG1, ("Start frame number retval: %u\n", retval));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||||
|
}
|
@ -103,3 +103,5 @@ int set_adc_invert(int);
|
|||||||
int get_adc_invert(int);
|
int get_adc_invert(int);
|
||||||
int set_external_sampling_source(int);
|
int set_external_sampling_source(int);
|
||||||
int set_external_sampling(int);
|
int set_external_sampling(int);
|
||||||
|
int set_starting_frame_number(int);
|
||||||
|
int get_starting_frame_number(int);
|
@ -623,6 +623,20 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
int configureMAC(int detPos = -1);
|
int configureMAC(int detPos = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set starting frame number for the next acquisition
|
||||||
|
* @param val starting frame number
|
||||||
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
|
*/
|
||||||
|
void setStartingFrameNumber(const uint64_t value, int detPos = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get starting frame number for the next acquisition
|
||||||
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
|
* @returns starting frame number
|
||||||
|
*/
|
||||||
|
uint64_t getStartingFrameNumber(int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get timer value (not all implemented for all detectors)
|
* Set/get timer value (not all implemented for all detectors)
|
||||||
* @param index timer index
|
* @param index timer index
|
||||||
@ -1785,9 +1799,9 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
/**
|
/**
|
||||||
* Gets the current frame index of receiver
|
* Gets the current frame index of receiver
|
||||||
* @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 current frame index of receiver
|
* @returns average of all current frame index of receiver
|
||||||
*/
|
*/
|
||||||
int getReceiverCurrentFrameIndex(int detPos = -1);
|
uint64_t getReceiverCurrentFrameIndex(int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets framescaught in receiver
|
* Resets framescaught in receiver
|
||||||
|
@ -730,6 +730,18 @@ class slsDetector : public virtual slsDetectorDefs{
|
|||||||
*/
|
*/
|
||||||
int configureMAC();
|
int configureMAC();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set starting frame number for the next acquisition
|
||||||
|
* @param val starting frame number
|
||||||
|
*/
|
||||||
|
void setStartingFrameNumber(const uint64_t value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get starting frame number for the next acquisition
|
||||||
|
* @returns starting frame number
|
||||||
|
*/
|
||||||
|
uint64_t getStartingFrameNumber();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get timer value (not all implemented for all detectors)
|
* Set/get timer value (not all implemented for all detectors)
|
||||||
* @param index timer index
|
* @param index timer index
|
||||||
@ -1695,7 +1707,7 @@ class slsDetector : public virtual slsDetectorDefs{
|
|||||||
* Gets the current frame index of receiver
|
* Gets the current frame index of receiver
|
||||||
* @returns current frame index of receiver
|
* @returns current frame index of receiver
|
||||||
*/
|
*/
|
||||||
int getReceiverCurrentFrameIndex();
|
uint64_t getReceiverCurrentFrameIndex();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets framescaught in receiver
|
* Resets framescaught in receiver
|
||||||
|
@ -1057,6 +1057,34 @@ int multiSlsDetector::configureMAC(int detPos) {
|
|||||||
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
|
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void multiSlsDetector::setStartingFrameNumber(const uint64_t value, int detPos) {
|
||||||
|
// single
|
||||||
|
if (detPos >= 0) {
|
||||||
|
return detectors[detPos]->setStartingFrameNumber(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// multi
|
||||||
|
parallelCall(&slsDetector::setStartingFrameNumber, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t multiSlsDetector::getStartingFrameNumber(int detPos) {
|
||||||
|
// single
|
||||||
|
if (detPos >= 0) {
|
||||||
|
return detectors[detPos]->getStartingFrameNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
// multi
|
||||||
|
auto r = parallelCall(&slsDetector::getStartingFrameNumber);
|
||||||
|
if (sls::allEqual(r)) {
|
||||||
|
return r.front();
|
||||||
|
}
|
||||||
|
|
||||||
|
// can't have different values for next acquisition
|
||||||
|
std::ostringstream ss;
|
||||||
|
ss << "Error: Different Values for starting frame number";
|
||||||
|
throw RuntimeError(ss.str());
|
||||||
|
}
|
||||||
|
|
||||||
int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t, int detPos) {
|
int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
@ -3121,7 +3149,7 @@ int multiSlsDetector::getFramesCaughtByReceiver(int detPos) {
|
|||||||
return ((sls::sum(r)) / (int)detectors.size());
|
return ((sls::sum(r)) / (int)detectors.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
int multiSlsDetector::getReceiverCurrentFrameIndex(int detPos) {
|
uint64_t multiSlsDetector::getReceiverCurrentFrameIndex(int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->getReceiverCurrentFrameIndex();
|
return detectors[detPos]->getReceiverCurrentFrameIndex();
|
||||||
@ -3131,7 +3159,7 @@ int multiSlsDetector::getReceiverCurrentFrameIndex(int detPos) {
|
|||||||
auto r = parallelCall(&slsDetector::getReceiverCurrentFrameIndex);
|
auto r = parallelCall(&slsDetector::getReceiverCurrentFrameIndex);
|
||||||
|
|
||||||
// prevent divide by all or do not take avg when -1 for "did not connect"
|
// prevent divide by all or do not take avg when -1 for "did not connect"
|
||||||
if ((detectors.empty()) || (sls::anyEqualTo(r, -1))) {
|
if ((detectors.empty()) || (sls::anyEqualTo(r, static_cast<uint64_t>(-1)))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1497,6 +1497,23 @@ int slsDetector::configureMAC() {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void slsDetector::setStartingFrameNumber(const uint64_t value) {
|
||||||
|
FILE_LOG(logDEBUG1) << "Setting starting frame number to " << value;
|
||||||
|
if (shm()->onlineFlag == ONLINE_FLAG) {
|
||||||
|
sendToDetector(F_SET_STARTING_FRAME_NUMBER, value, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t slsDetector::getStartingFrameNumber() {
|
||||||
|
uint64_t retval = -1;
|
||||||
|
FILE_LOG(logDEBUG1) << "Getting starting frame number";
|
||||||
|
if (shm()->onlineFlag == ONLINE_FLAG) {
|
||||||
|
sendToDetector(F_GET_STARTING_FRAME_NUMBER, nullptr, retval);
|
||||||
|
FILE_LOG(logDEBUG1) << "Starting frame number :" << retval;
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
|
int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
int64_t args[]{static_cast<int64_t>(index), t};
|
int64_t args[]{static_cast<int64_t>(index), t};
|
||||||
@ -1554,6 +1571,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
|
|||||||
DIGITAL_SAMPLES,
|
DIGITAL_SAMPLES,
|
||||||
STORAGE_CELL_NUMBER};
|
STORAGE_CELL_NUMBER};
|
||||||
|
|
||||||
|
// if in list (lambda)
|
||||||
if (std::any_of(std::begin(rt), std::end(rt),
|
if (std::any_of(std::begin(rt), std::end(rt),
|
||||||
[index](timerIndex t) { return t == index; })) {
|
[index](timerIndex t) { return t == index; })) {
|
||||||
args[1] = shm()->timerValue[index];
|
args[1] = shm()->timerValue[index];
|
||||||
@ -3592,8 +3610,8 @@ int slsDetector::getFramesCaughtByReceiver() {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetector::getReceiverCurrentFrameIndex() {
|
uint64_t slsDetector::getReceiverCurrentFrameIndex() {
|
||||||
int retval = -1;
|
uint64_t retval = -1;
|
||||||
FILE_LOG(logDEBUG1) << "Getting Current Frame Index of Receiver";
|
FILE_LOG(logDEBUG1) << "Getting Current Frame Index of Receiver";
|
||||||
if (shm()->rxOnlineFlag == ONLINE_FLAG) {
|
if (shm()->rxOnlineFlag == ONLINE_FLAG) {
|
||||||
sendToReceiver(F_GET_RECEIVER_FRAME_INDEX, nullptr, retval);
|
sendToReceiver(F_GET_RECEIVER_FRAME_INDEX, nullptr, retval);
|
||||||
|
@ -596,6 +596,13 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdTimer;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdTimer;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
|
/*! \page timing
|
||||||
|
- <b>startingfnum [i]</b> sets/gets starting frame number for the next acquisition. Only for Jungfrau and Eiger. \c Returns \c (long long int)
|
||||||
|
*/
|
||||||
|
descrToFuncMap[i].m_pFuncName = "startingfnum";
|
||||||
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdTimer;
|
||||||
|
++i;
|
||||||
|
|
||||||
/*! \page timing
|
/*! \page timing
|
||||||
- <b>cycles [i]</b> sets/gets number of triggers. Timing mode should be set appropriately. \c Returns \c (long long int)
|
- <b>cycles [i]</b> sets/gets number of triggers. Timing mode should be set appropriately. \c Returns \c (long long int)
|
||||||
*/
|
*/
|
||||||
@ -4477,6 +4484,16 @@ std::string slsDetectorCommand::cmdTimer(int narg, const char * const args[], in
|
|||||||
}
|
}
|
||||||
sprintf(answer, "%d", myDet->setStoragecellStart(-1, detPos));
|
sprintf(answer, "%d", myDet->setStoragecellStart(-1, detPos));
|
||||||
return std::string(answer);
|
return std::string(answer);
|
||||||
|
} else if (cmd == "startingfnum") {
|
||||||
|
myDet->setOnline(ONLINE_FLAG, detPos);
|
||||||
|
if (action == PUT_ACTION) {
|
||||||
|
uint64_t ival = -1;
|
||||||
|
if (!sscanf(args[1], "%lu", &ival))
|
||||||
|
return std::string("cannot scan starting frame number value ") + std::string(args[1]);
|
||||||
|
myDet->setStartingFrameNumber(ival, detPos);
|
||||||
|
return std::string(args[1]);
|
||||||
|
}
|
||||||
|
return std::to_string(myDet->getStartingFrameNumber(detPos));
|
||||||
} else
|
} else
|
||||||
return std::string("could not decode timer ") + cmd;
|
return std::string("could not decode timer ") + cmd;
|
||||||
|
|
||||||
@ -4528,6 +4545,7 @@ std::string slsDetectorCommand::helpTimer(int action) {
|
|||||||
os << "period t \t sets the frame period in s" << std::endl;
|
os << "period t \t sets the frame period in s" << std::endl;
|
||||||
os << "delay t \t sets the delay after trigger in s" << std::endl;
|
os << "delay t \t sets the delay after trigger in s" << std::endl;
|
||||||
os << "frames t \t sets the number of frames per cycle (e.g. after each trigger)" << std::endl;
|
os << "frames t \t sets the number of frames per cycle (e.g. after each trigger)" << std::endl;
|
||||||
|
os << "startingfnum t \t sets starting frame number for the next acquisition. Only for Jungfrau and Eiger." << std::endl;
|
||||||
os << "cycles t \t sets the number of cycles (e.g. number of triggers)" << std::endl;
|
os << "cycles t \t sets the number of cycles (e.g. number of triggers)" << std::endl;
|
||||||
os << "samples t \t sets the number of samples (both analog and digital) expected from the ctb" << std::endl;
|
os << "samples t \t sets the number of samples (both analog and digital) expected from the ctb" << std::endl;
|
||||||
os << "asamples t \t sets the number of analog samples expected from the ctb" << std::endl;
|
os << "asamples t \t sets the number of analog samples expected from the ctb" << std::endl;
|
||||||
@ -4545,6 +4563,7 @@ std::string slsDetectorCommand::helpTimer(int action) {
|
|||||||
os << "period \t gets the frame period in s" << std::endl;
|
os << "period \t gets the frame period in s" << std::endl;
|
||||||
os << "delay \t gets the delay after trigger in s" << std::endl;
|
os << "delay \t gets the delay after trigger in s" << std::endl;
|
||||||
os << "frames \t gets the number of frames per cycle (e.g. after each trigger)" << std::endl;
|
os << "frames \t gets the number of frames per cycle (e.g. after each trigger)" << std::endl;
|
||||||
|
os << "startingfnum \t gets starting frame number for the next acquisition. Only for Jungfrau and Eiger." << std::endl;
|
||||||
os << "cycles \t gets the number of cycles (e.g. number of triggers)" << std::endl;
|
os << "cycles \t gets the number of cycles (e.g. number of triggers)" << std::endl;
|
||||||
os << "samples \t gets the number of samples (both analog and digital) expected from the ctb" << std::endl;
|
os << "samples \t gets the number of samples (both analog and digital) expected from the ctb" << std::endl;
|
||||||
os << "asamples \t gets the number of analog samples expected from the ctb" << std::endl;
|
os << "asamples \t gets the number of analog samples expected from the ctb" << std::endl;
|
||||||
@ -5078,7 +5097,7 @@ std::string slsDetectorCommand::cmdReceiver(int narg, const char * const args[],
|
|||||||
if (action == PUT_ACTION)
|
if (action == PUT_ACTION)
|
||||||
return std::string("cannot put");
|
return std::string("cannot put");
|
||||||
else {
|
else {
|
||||||
sprintf(answer, "%d", myDet->getReceiverCurrentFrameIndex(detPos));
|
sprintf(answer, "%lu", myDet->getReceiverCurrentFrameIndex(detPos));
|
||||||
return std::string(answer);
|
return std::string(answer);
|
||||||
}
|
}
|
||||||
} else if (cmd == "r_readfreq") {
|
} else if (cmd == "r_readfreq") {
|
||||||
|
@ -156,9 +156,9 @@ class slsReceiverImplementation: private virtual slsDetectorDefs {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Current Frame Index for an entire acquisition (including all scans)
|
* Get Current Frame Index for an entire acquisition (including all scans)
|
||||||
* @return -1 if no frames have been caught, else current frame index (represents all scans too)
|
* @return 0 if no frames have been caught, else average of all current frame index
|
||||||
*/
|
*/
|
||||||
int64_t getAcquisitionIndex() const;
|
uint64_t getAcquisitionIndex() const;
|
||||||
|
|
||||||
|
|
||||||
//***connection parameters***
|
//***connection parameters***
|
||||||
@ -586,7 +586,7 @@ class slsReceiverImplementation: private virtual slsDetectorDefs {
|
|||||||
* The data receiver status will change from running to idle when it gets this number of frames
|
* The data receiver status will change from running to idle when it gets this number of frames
|
||||||
* @param i number of frames expected
|
* @param i number of frames expected
|
||||||
*/
|
*/
|
||||||
int setNumberOfFrames(const uint64_t i);
|
void setNumberOfFrames(const uint64_t i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Number of Analog Samples expected by receiver from detector
|
* Set Number of Analog Samples expected by receiver from detector
|
||||||
|
@ -249,7 +249,7 @@ uint64_t slsReceiverImplementation::getFramesCaught() const {
|
|||||||
return (sum/dataProcessor.size());
|
return (sum/dataProcessor.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t slsReceiverImplementation::getAcquisitionIndex() const {
|
uint64_t slsReceiverImplementation::getAcquisitionIndex() const {
|
||||||
uint64_t sum = 0;
|
uint64_t sum = 0;
|
||||||
uint32_t flagsum = 0;
|
uint32_t flagsum = 0;
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ int64_t slsReceiverImplementation::getAcquisitionIndex() const {
|
|||||||
}
|
}
|
||||||
//no data processed
|
//no data processed
|
||||||
if (flagsum != dataProcessor.size())
|
if (flagsum != dataProcessor.size())
|
||||||
return -1;
|
return 0;
|
||||||
|
|
||||||
return (sum/dataProcessor.size());
|
return (sum/dataProcessor.size());
|
||||||
}
|
}
|
||||||
@ -963,13 +963,11 @@ void slsReceiverImplementation::setSubPeriod(const uint64_t i) {
|
|||||||
FILE_LOG(logINFO) << "Sub Exposure Period: " << (double)subPeriod/(1E9) << "s";
|
FILE_LOG(logINFO) << "Sub Exposure Period: " << (double)subPeriod/(1E9) << "s";
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsReceiverImplementation::setNumberOfFrames(const uint64_t i) {
|
void slsReceiverImplementation::setNumberOfFrames(const uint64_t i) {
|
||||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||||
|
|
||||||
numberOfFrames = i;
|
numberOfFrames = i;
|
||||||
FILE_LOG(logINFO) << "Number of Frames: " << numberOfFrames;
|
FILE_LOG(logINFO) << "Number of Frames: " << numberOfFrames;
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1205,7 +1205,7 @@ int slsReceiverTCPIPInterface::set_file_index(sls::ServerInterface2 &socket) {
|
|||||||
int slsReceiverTCPIPInterface::get_frame_index(sls::ServerInterface2 &socket){
|
int slsReceiverTCPIPInterface::get_frame_index(sls::ServerInterface2 &socket){
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int retval = -1;
|
uint64_t retval = -1;
|
||||||
|
|
||||||
if(receiver == nullptr){
|
if(receiver == nullptr){
|
||||||
NullObjectError(ret, mess);
|
NullObjectError(ret, mess);
|
||||||
|
@ -87,6 +87,8 @@ enum detFuncs{
|
|||||||
F_GET_ADC_INVERT, /** < get adc invert reg */
|
F_GET_ADC_INVERT, /** < get adc invert reg */
|
||||||
F_EXTERNAL_SAMPLING_SOURCE, /** < set/get external sampling source for ctb */
|
F_EXTERNAL_SAMPLING_SOURCE, /** < set/get external sampling source for ctb */
|
||||||
F_EXTERNAL_SAMPLING, /**< enable/disable external sampling for ctb */
|
F_EXTERNAL_SAMPLING, /**< enable/disable external sampling for ctb */
|
||||||
|
F_SET_STARTING_FRAME_NUMBER,
|
||||||
|
F_GET_STARTING_FRAME_NUMBER,
|
||||||
NUM_DET_FUNCTIONS,
|
NUM_DET_FUNCTIONS,
|
||||||
|
|
||||||
RECEIVER_ENUM_START = 128, /**< detector function should not exceed this (detector server should not compile anyway) */
|
RECEIVER_ENUM_START = 128, /**< detector function should not exceed this (detector server should not compile anyway) */
|
||||||
@ -227,7 +229,8 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_GET_ADC_INVERT: return "F_GET_ADC_INVERT";
|
case F_GET_ADC_INVERT: return "F_GET_ADC_INVERT";
|
||||||
case F_EXTERNAL_SAMPLING_SOURCE: return "F_EXTERNAL_SAMPLING_SOURCE";
|
case F_EXTERNAL_SAMPLING_SOURCE: return "F_EXTERNAL_SAMPLING_SOURCE";
|
||||||
case F_EXTERNAL_SAMPLING: return "F_EXTERNAL_SAMPLING";
|
case F_EXTERNAL_SAMPLING: return "F_EXTERNAL_SAMPLING";
|
||||||
|
case F_SET_STARTING_FRAME_NUMBER: return "F_SET_STARTING_FRAME_NUMBER";
|
||||||
|
case F_GET_STARTING_FRAME_NUMBER: return "F_GET_STARTING_FRAME_NUMBER";
|
||||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||||
|
|
||||||
|
@ -5,6 +5,6 @@
|
|||||||
#define APILIB 0x190405
|
#define APILIB 0x190405
|
||||||
#define APIRECEIVER 0x190405
|
#define APIRECEIVER 0x190405
|
||||||
#define APIGUI 0x190405
|
#define APIGUI 0x190405
|
||||||
#define APIEIGER 0x190516
|
|
||||||
#define APICTB 0x190528
|
#define APICTB 0x190528
|
||||||
#define APIJUNGFRAU 0x190528
|
#define APIEIGER 0x190531
|
||||||
|
#define APIJUNGFRAU 0x190531
|
||||||
|
@ -65,7 +65,7 @@ int DataSocket::setReceiveTimeout(int us) {
|
|||||||
|
|
||||||
int DataSocket::sendData(const void *buffer, size_t size) {
|
int DataSocket::sendData(const void *buffer, size_t size) {
|
||||||
int dataSent = 0;
|
int dataSent = 0;
|
||||||
while (dataSent < size) {
|
while (dataSent < (int)size) {
|
||||||
dataSent +=
|
dataSent +=
|
||||||
write(getSocketId(), reinterpret_cast<const char *>(buffer) + dataSent,
|
write(getSocketId(), reinterpret_cast<const char *>(buffer) + dataSent,
|
||||||
size - dataSent);
|
size - dataSent);
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
|
|
||||||
struct SingleDetectorConfig {
|
struct SingleDetectorConfig {
|
||||||
slsDetectorDefs::detectorType type_enum =
|
slsDetectorDefs::detectorType type_enum = slsDetectorDefs::detectorType::EIGER;
|
||||||
slsDetectorDefs::detectorType::CHIPTESTBOARD;
|
const std::string hostname = "beb031+beb032+";
|
||||||
const std::string hostname = "bchip173";
|
const std::string type_string = "Eiger";
|
||||||
const std::string type_string = "Chiptestboard";
|
|
||||||
const std::string my_ip = "129.129.205.171";
|
const std::string my_ip = "129.129.205.171";
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user