mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 15:50:03 +02:00
Anna's modifications
This commit is contained in:
commit
3aeb15648c
@ -14,23 +14,24 @@ INCLUDES?= -IcommonFiles -IslsDetector -I../slsReceiverSoftware/MySocketTCP -Ius
|
||||
|
||||
#EPICSFLAGS=-D EPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom
|
||||
|
||||
|
||||
SRC_CLNT=slsDetectorAnalysis/fileIO.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/angularConversionStatic.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsDetectorAnalysis/postProcessingFuncs.cpp slsReceiverInterface/receiverInterface.cpp slsDetector/slsDetectorUsers.cpp threadFiles/CondVar.cpp threadFiles/Mutex.cpp threadFiles/ThreadPool.cpp #../slsReceiverSoftware/MySocketTCP/MySocketTCP.cpp
|
||||
|
||||
|
||||
LIBZMQDIR = ../slsReceiverSoftware/include
|
||||
LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
|
||||
|
||||
SRC_CLNT=slsDetectorAnalysis/fileIO.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/angularConversionStatic.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsDetectorAnalysis/postProcessingFuncs.cpp slsReceiverInterface/receiverInterface.cpp slsDetector/slsDetectorUsers.cpp threadFiles/CondVar.cpp threadFiles/Mutex.cpp threadFiles/ThreadPool.cpp #../slsReceiverSoftware/MySocketTCP/MySocketTCP.cpp
|
||||
DEPSINCLUDES = $(LIBZMQDIR)/sls_receiver_defs.h $(LIBZMQDIR)/sls_receiver_funcs.h $(LIBZMQDIR)/ansi.h commonFiles/sls_detector_defs.h commonFiles/sls_detector_funcs.h commonFiles/error_defs.h slsDetector/slsDetectorBase.h slsDetectorAnalysis/angCalLogClass.h slsDetectorAnalysis/angleConversionConstant.h slsDetectorAnalysis/badChannelCorrections.h slsDetectorAnalysis/detectorData.h slsDetectorAnalysis/enCalLogClass.h slsDetectorAnalysis/fileIOStatic.h slsDetectorAnalysis/movingStat.h slsDetectorAnalysis/runningStat.h slsDetectorAnalysis/single_photon_hit.h threadFiles/Global.h threadFiles/Task.h usersFunctions/angleFunction.h
|
||||
|
||||
|
||||
|
||||
$(info )
|
||||
$(info #######################################)
|
||||
$(info # Compiling slsDetectorSoftware #)
|
||||
$(info # In slsDetectorSoftware Makefile #)
|
||||
$(info #######################################)
|
||||
$(info )
|
||||
|
||||
|
||||
|
||||
|
||||
OBJS = $(SRC_CLNT:.cpp=.o)
|
||||
OBJS = $(SRC_CLNT:%.cpp=%.o)
|
||||
|
||||
.PHONY: all intdoc doc htmldoc package clean
|
||||
|
||||
@ -67,15 +68,19 @@ gotthardVirtualServer: $(SRC_MYTHEN_SVC)
|
||||
cd gotthardDetectorServer && make -f Makefile.virtual DESTDIR=$(DESTDIR)
|
||||
|
||||
|
||||
|
||||
%.o : %.cpp %.h Makefile
|
||||
%.o : %.cpp %.h $(DEPSINCLUDES) Makefile
|
||||
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -pthread -lrt $(LIBZMQ) $(FLAGS)
|
||||
|
||||
|
||||
package: $(OBJS) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
||||
package: versioning $(OBJS) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
||||
|
||||
versioning:
|
||||
$(call colorecho,`./updateGitVersion.sh`)
|
||||
|
||||
$(DESTDIR)/libSlsDetector.so: $(OBJS)
|
||||
$(call colorecho,"#######################################")
|
||||
$(call colorecho,"# Compiling slsDetector Library #")
|
||||
$(call colorecho,"#######################################")
|
||||
$(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -pthread -lrt $(LIBZMQ)
|
||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
||||
mv libSlsDetector.so $(DESTDIR)
|
||||
@ -87,6 +92,9 @@ $(DESTDIR)/libSlsDetector.a: $(OBJS)
|
||||
clean:
|
||||
rm -rf $(DESTDIR)/libSlsDetector.a $(DESTDIR)/libSlsDetector.so core docs/* slsDetectorUsersDocs $(OBJS)
|
||||
cd
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
|
@ -550,6 +550,16 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
||||
myMod->chipregs=chipptr;
|
||||
myMod->chanregs=chanptr;
|
||||
|
||||
#ifdef EIGERD
|
||||
//feature to exclude sending of trimbtis, nchips=0,nchans=0 in that case
|
||||
if(myMod->nchip == 0 && myMod->nchan == 0) {
|
||||
receiveAll=0;
|
||||
nchipold=0;
|
||||
nchanold=0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
nChips=myMod->nchip;
|
||||
nchipdiff=nChips-nchipold;
|
||||
if (nchipold!=nChips) {
|
||||
|
@ -43,7 +43,8 @@ using namespace std;
|
||||
#define COULDNOT_STOP_RECEIVER 0x0000800000000000ULL
|
||||
#define RECEIVER_DET_POSID_NOT_SET 0x0000400000000000ULL
|
||||
#define RECEIVER_MULTI_DET_SIZE_NOT_SET 0x0000200000000000ULL
|
||||
|
||||
#define PREPARE_ACQUISITION 0x0000100000000000ULL
|
||||
#define CLEANUP_ACQUISITION 0x0000080000000000ULL
|
||||
// 0xFFFFFFF000000000ULL
|
||||
|
||||
// 0x0000000FFFFFFFFFULL
|
||||
@ -79,6 +80,7 @@ using namespace std;
|
||||
#define RECEIVER_FLIPPED_DATA_NOT_SET 0x0000000020000000ULL
|
||||
#define THRESHOLD_NOT_SET 0x0000000040000000ULL
|
||||
#define RECEIVER_FILE_FORMAT 0x0000000080000000ULL
|
||||
#define RECEIVER_SUBF_TIME_NOT_SET 0x0000000100000000ULL
|
||||
// 0x0000000FFFFFFFFFULL
|
||||
|
||||
/** @short class returning all error messages for error mask */
|
||||
@ -145,6 +147,12 @@ public:
|
||||
if(slsErrorMask&RECEIVER_MULTI_DET_SIZE_NOT_SET)
|
||||
retval.append("Could not set multi detector size\n");
|
||||
|
||||
if(slsErrorMask&PREPARE_ACQUISITION)
|
||||
retval.append("Could not prepare acquisition in detector\n");
|
||||
|
||||
if(slsErrorMask&CLEANUP_ACQUISITION)
|
||||
retval.append("Could not clean up after acquisition in detector\n");
|
||||
|
||||
|
||||
|
||||
|
||||
@ -251,6 +259,9 @@ public:
|
||||
if(slsErrorMask&RECEIVER_FILE_FORMAT)
|
||||
retval.append("Could not set receiver file format\n");
|
||||
|
||||
if(slsErrorMask&RECEIVER_SUBF_TIME_NOT_SET)
|
||||
retval.append("Could not set sub exposure time in receiver.\n");
|
||||
|
||||
|
||||
//------------------------------------------------------ length of message
|
||||
|
||||
|
@ -192,7 +192,8 @@ enum networkParameter {
|
||||
DETECTOR_TXN_DELAY_FRAME, /**< transmission delay of a whole frame for all the ports */
|
||||
FLOW_CONTROL_10G, /**< flow control for 10GbE */
|
||||
FLOW_CONTROL_WR_PTR, /**< memory write pointer for flow control */
|
||||
FLOW_CONTROL_RD_PTR /**< memory read pointer for flow control */
|
||||
FLOW_CONTROL_RD_PTR, /**< memory read pointer for flow control */
|
||||
RECEIVER_STREAMING_PORT /**< receiever streaming TCP(ZMQ) port */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1115,7 +1115,7 @@ int Beb_GetBebFPGATemp()
|
||||
}else{
|
||||
//read data
|
||||
ret = Beb_Read32(csp0base, FPGA_TEMP_OFFSET);
|
||||
temperature = ((((float)(ret)/65536.0f)/0.00198421639f ) - 273.15f); // Static conversation, copied from xps sysmon standalone driver
|
||||
temperature = ((((float)(ret)/65536.0f)/0.00198421639f ) - 273.15f)*1000; // Static conversation, copied from xps sysmon standalone driver
|
||||
//close file pointer
|
||||
Beb_close(fd,csp0base);
|
||||
}
|
||||
|
@ -24,8 +24,7 @@
|
||||
//GetDAQStatusRegister(512,current_mode_bits_from_fpga)){
|
||||
|
||||
unsigned int Module_ndacs = 16;
|
||||
char Module_dac_names[16][10]= {"SvP","Vtr","Vrf","Vrs","SvN","Vtgstv","Vcmp_ll","Vcmp_lr","cal","Vcmp_rl","rxb_rb","rxb_lb","Vcmp_rr","Vcp","Vcn","Vis"};;
|
||||
|
||||
char Module_dac_names[16][10]={"SvP","Vtr","Vrf","Vrs","SvN","Vtgstv","Vcmp_ll","Vcmp_lr","cal","Vcmp_rl","rxb_rb","rxb_lb","Vcmp_rr","Vcp","Vcn","Vis"};;
|
||||
|
||||
|
||||
|
||||
@ -1894,6 +1893,9 @@ int Feb_Control_PrintCorrectedValues(){
|
||||
}
|
||||
|
||||
|
||||
//So if software says now 40.00 you neeed to convert to mdegrees 40000(call it A1) and then
|
||||
//A1/65536/0.00198421639-273.15
|
||||
|
||||
int Feb_Control_GetLeftFPGATemp(){
|
||||
unsigned int temperature=0;
|
||||
if(Module_TopAddressIsValid(&modules[1]))
|
||||
@ -1901,6 +1903,7 @@ int Feb_Control_GetLeftFPGATemp(){
|
||||
else
|
||||
Feb_Interface_ReadRegister(Module_GetBottomLeftAddress (&modules[1]),FEB_REG_STATUS, &temperature);
|
||||
temperature = temperature >> 16;
|
||||
temperature = ((((float)(temperature)/65536.0f)/0.00198421639f ) - 273.15f)*1000; // Static conversation, copied from xps sysmon standalone driver
|
||||
//division done in client to send int over network
|
||||
return (int)temperature;
|
||||
}
|
||||
@ -1912,9 +1915,41 @@ int Feb_Control_GetRightFPGATemp(){
|
||||
else
|
||||
Feb_Interface_ReadRegister(Module_GetBottomRightAddress (&modules[1]),FEB_REG_STATUS, &temperature);
|
||||
temperature = temperature >> 16;
|
||||
temperature = ((((float)(temperature)/65536.0f)/0.00198421639f ) - 273.15f)*1000; // Static conversation, copied from xps sysmon standalone driver
|
||||
//division done in client to send int over network
|
||||
return (int)temperature;
|
||||
}
|
||||
|
||||
|
||||
uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
|
||||
uint32_t value=0;
|
||||
if(Module_TopAddressIsValid(&modules[1])){
|
||||
if(!Feb_Interface_WriteRegister(Module_GetTopRightAddress (&modules[1]),offset, data,0, 0)) {
|
||||
cprintf(RED,"Could not read value. Value read:%d\n", value);
|
||||
value = 0;
|
||||
}
|
||||
} else {
|
||||
if(!Feb_Interface_WriteRegister(Module_GetBottomRightAddress (&modules[1]),offset, data,0, 0)) {
|
||||
cprintf(RED,"Could not read value. Value read:%d\n", value);
|
||||
value = 0;
|
||||
}
|
||||
}
|
||||
return Feb_Control_ReadRegister(offset);
|
||||
}
|
||||
|
||||
|
||||
uint32_t Feb_Control_ReadRegister(uint32_t offset) {
|
||||
uint32_t value=0;
|
||||
if(Module_TopAddressIsValid(&modules[1])){
|
||||
if(!Feb_Interface_ReadRegister(Module_GetTopRightAddress (&modules[1]),offset, &value)) {
|
||||
cprintf(RED,"Could not read value. Value read:%d\n", value);
|
||||
value = 0;
|
||||
}
|
||||
} else {
|
||||
if(!Feb_Interface_ReadRegister(Module_GetBottomRightAddress (&modules[1]),offset, &value)) {
|
||||
cprintf(RED,"Could not read value. Value read:%d\n", value);
|
||||
value = 0;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -198,4 +198,6 @@ int Feb_Control_GetModuleNumber();
|
||||
int Feb_Control_GetLeftFPGATemp();
|
||||
int Feb_Control_GetRightFPGATemp();
|
||||
|
||||
uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
|
||||
uint32_t Feb_Control_ReadRegister(uint32_t offset);
|
||||
#endif
|
||||
|
@ -12,13 +12,16 @@ SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c
|
||||
OBJS = $(SRC_CLNT:.c=.o)
|
||||
|
||||
|
||||
all: clean $(PROGS) #hv9m_blackfin_server
|
||||
all: clean versioning $(PROGS) #hv9m_blackfin_server
|
||||
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
$(PROGS):
|
||||
echo $(OBJS)
|
||||
versioning:
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
# echo $(OBJS)
|
||||
mkdir -p $(DESTDIR)
|
||||
$(CC) -o $@ $(SRC_CLNT) $(CFLAGS) $(LDLIBS)
|
||||
mv $(PROGS) $(DESTDIR)
|
||||
@ -32,3 +35,4 @@ hv9m_blackfin_server:9mhvserial_bf.c
|
||||
clean:
|
||||
rm -rf $(DESTDIR)/$(PROGS) *.o $(DESTDIR)/hv9m_blackfin_server
|
||||
|
||||
|
||||
|
Binary file not shown.
BIN
slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv3.0.0.16.6
Executable file
BIN
slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv3.0.0.16.6
Executable file
Binary file not shown.
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repsitory UUID: a5b59b47430913bb461b50da05b553874b33f39a
|
||||
Revision: 287
|
||||
Branch: developer
|
||||
Repsitory UUID: 2dfbd9016b501eca6ee2c00a08e49a3f7e7990d8
|
||||
Revision: 296
|
||||
Branch: 3.0-rc
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 1418
|
||||
Last Changed Date: 2017-06-22 14:32:24 +0200
|
||||
Last Changed Rev: 1457
|
||||
Last Changed Date: 2017-08-08 15:23:10.000000002 +0200 ./Makefile
|
||||
|
@ -1,11 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer"
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "a5b59b47430913bb461b50da05b553874b33f39a"
|
||||
//#define SVNREV 0x1418
|
||||
#define SVNREPUUID "2dfbd9016b501eca6ee2c00a08e49a3f7e7990d8"
|
||||
//#define SVNREV 0x1457
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "Dhanya_Maliakal"
|
||||
#define SVNREV 0x1418
|
||||
#define SVNDATE 0x20170622
|
||||
#define SVNREV 0x1457
|
||||
#define SVNDATE 0x20170808
|
||||
//
|
||||
|
@ -30,6 +30,7 @@ dacs_t *detectorDacs=NULL;
|
||||
dacs_t *detectorAdcs=NULL;
|
||||
|
||||
int eiger_highvoltage = 0;
|
||||
int eiger_theo_highvoltage = 0;
|
||||
int eiger_iodelay = 0;
|
||||
int eiger_photonenergy = 0;
|
||||
int eiger_dynamicrange = 0;
|
||||
@ -341,7 +342,14 @@ void setupDetector() {
|
||||
|
||||
|
||||
|
||||
/* advanced read/write reg */
|
||||
uint32_t writeRegister(uint32_t offset, uint32_t data) {
|
||||
return Feb_Control_WriteRegister(offset, data);
|
||||
}
|
||||
|
||||
uint32_t readRegister(uint32_t offset) {
|
||||
return Feb_Control_ReadRegister(offset);
|
||||
}
|
||||
|
||||
|
||||
/* set parameters - nmod, dr, roi */
|
||||
@ -542,25 +550,31 @@ int setModule(sls_detector_module myMod, int delay){
|
||||
for(i=0;i<myMod.ndac;i++)
|
||||
setDAC((enum DACINDEX)i,myMod.dacs[i],myMod.module,0,retval);
|
||||
|
||||
//includ gap pixels
|
||||
unsigned int tt[263680];
|
||||
int iy,ichip,ix,ip=0,ich=0;
|
||||
for(iy=0;iy<256;iy++) {
|
||||
for (ichip=0; ichip<4; ichip++) {
|
||||
for(ix=0;ix<256;ix++) {
|
||||
tt[ip++]=myMod.chanregs[ich++];
|
||||
}
|
||||
if (ichip<3) {
|
||||
tt[ip++]=0;
|
||||
tt[ip++]=0;
|
||||
|
||||
if(myMod.nchan==0 && myMod.nchip == 0)
|
||||
cprintf(BLUE,"Setting module without trimbits\n");
|
||||
else{
|
||||
cprintf(GREEN,"Setting module with trimbits\n");
|
||||
//includ gap pixels
|
||||
unsigned int tt[263680];
|
||||
int iy,ichip,ix,ip=0,ich=0;
|
||||
for(iy=0;iy<256;iy++) {
|
||||
for (ichip=0; ichip<4; ichip++) {
|
||||
for(ix=0;ix<256;ix++) {
|
||||
tt[ip++]=myMod.chanregs[ich++];
|
||||
}
|
||||
if (ichip<3) {
|
||||
tt[ip++]=0;
|
||||
tt[ip++]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set trimbits
|
||||
if(!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(),tt)){
|
||||
cprintf(BG_RED,"Could not set trimbits\n");
|
||||
return FAIL;
|
||||
//set trimbits
|
||||
if(!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(),tt)){
|
||||
cprintf(BG_RED,"Could not set trimbits\n");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return thisSettings;
|
||||
@ -709,7 +723,7 @@ int getADC(enum ADCINDEX ind, int imod){
|
||||
|
||||
switch(ind){
|
||||
case TEMP_FPGA:
|
||||
retval=getBebFPGATemp()*1000;
|
||||
retval=getBebFPGATemp();
|
||||
break;
|
||||
case TEMP_FPGAFEBL:
|
||||
retval=Feb_Control_GetLeftFPGATemp();
|
||||
@ -739,22 +753,33 @@ int getADC(enum ADCINDEX ind, int imod){
|
||||
|
||||
|
||||
int setHighVoltage(int val){
|
||||
if(val!=-1){
|
||||
eiger_highvoltage = val;
|
||||
if(master){
|
||||
if (master) {
|
||||
|
||||
// set
|
||||
if(val!=-1){
|
||||
eiger_theo_highvoltage = val;
|
||||
int ret = Feb_Control_SetHighVoltage(val);
|
||||
if(!ret) //could not set
|
||||
return -2;
|
||||
else if (ret == -1) //outside range
|
||||
return -1;
|
||||
}
|
||||
|
||||
// get
|
||||
if (!Feb_Control_GetHighVoltage(&eiger_highvoltage)) {
|
||||
cprintf(RED,"Warning: Could not read high voltage\n");
|
||||
return -3;
|
||||
}
|
||||
|
||||
// tolerance of 5
|
||||
if (abs(eiger_theo_highvoltage-eiger_highvoltage) > HIGH_VOLTAGE_TOLERANCE) {
|
||||
cprintf(BLUE, "High voltage still ramping: %d\n", eiger_highvoltage);
|
||||
return eiger_highvoltage;
|
||||
}
|
||||
return eiger_theo_highvoltage;
|
||||
}
|
||||
|
||||
if(master && !Feb_Control_GetHighVoltage(&eiger_highvoltage)){
|
||||
cprintf(RED,"Warning: Could not read high voltage\n");
|
||||
return -3;
|
||||
}
|
||||
return eiger_highvoltage;
|
||||
return SLAVE_HIGH_VOLTAGE_READ_VAL;
|
||||
}
|
||||
|
||||
|
||||
@ -1211,11 +1236,13 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
|
||||
|
||||
destMod->serialnumber=srcMod->serialnumber;
|
||||
}
|
||||
if ((srcMod->nchip)>(destMod->nchip)) {
|
||||
//no trimbit feature
|
||||
if (destMod->nchip && ((srcMod->nchip)>(destMod->nchip))) {
|
||||
printf("Number of chip of source is larger than number of chips of destination\n");
|
||||
return FAIL;
|
||||
}
|
||||
if ((srcMod->nchan)>(destMod->nchan)) {
|
||||
//no trimbit feature
|
||||
if (destMod->nchan && ((srcMod->nchan)>(destMod->nchan))) {
|
||||
printf("Number of channels of source is larger than number of channels of destination\n");
|
||||
return FAIL;
|
||||
}
|
||||
@ -1249,14 +1276,19 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
|
||||
if (srcMod->offset>=0)
|
||||
destMod->offset=srcMod->offset;
|
||||
|
||||
for (ichip=0; ichip<(srcMod->nchip); ichip++) {
|
||||
if (*((srcMod->chipregs)+ichip)>=0)
|
||||
*((destMod->chipregs)+ichip)=*((srcMod->chipregs)+ichip);
|
||||
}
|
||||
for (ichan=0; ichan<(srcMod->nchan); ichan++) {
|
||||
if (*((srcMod->chanregs)+ichan)>=0)
|
||||
*((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan);
|
||||
if((destMod->nchip!=0) || (destMod->nchan!=0)) {
|
||||
for (ichip=0; ichip<(srcMod->nchip); ichip++) {
|
||||
if (*((srcMod->chipregs)+ichip)>=0)
|
||||
*((destMod->chipregs)+ichip)=*((srcMod->chipregs)+ichip);
|
||||
}
|
||||
for (ichan=0; ichan<(srcMod->nchan); ichan++) {
|
||||
if (*((srcMod->chanregs)+ichan)>=0)
|
||||
*((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan);
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
else printf("Not Copying trimbits\n");
|
||||
#endif
|
||||
for (idac=0; idac<(srcMod->ndac); idac++) {
|
||||
if (*((srcMod->dacs)+idac)>=0)
|
||||
*((destMod->dacs)+idac)=*((srcMod->dacs)+idac);
|
||||
@ -1277,8 +1309,8 @@ int calculateDataBytes(){
|
||||
}
|
||||
|
||||
|
||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerModule() * (int)getTotalNumberOfModules);}
|
||||
int getTotalNumberOfChips(){return ((int)getNumberOfChipsPerModule * (int)getTotalNumberOfModules);}
|
||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerModule() * (int)getTotalNumberOfModules());}
|
||||
int getTotalNumberOfChips(){return ((int)getNumberOfChipsPerModule() * (int)getTotalNumberOfModules());}
|
||||
int getTotalNumberOfModules(){return NMOD;}
|
||||
int getNumberOfChannelsPerModule(){return ((int)getNumberOfChannelsPerChip() * (int)getTotalNumberOfChips());}
|
||||
int getNumberOfChipsPerModule(){return NCHIP;}
|
||||
|
@ -84,6 +84,8 @@ enum NETWORKINDEX {TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G};
|
||||
|
||||
#define MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS (0x1FFFFFFF) /** 29 bit register for max subframe exposure value */
|
||||
|
||||
#define SLAVE_HIGH_VOLTAGE_READ_VAL (-999)
|
||||
#define HIGH_VOLTAGE_TOLERANCE (5)
|
||||
|
||||
|
||||
#endif /* SLSDETECTORSERVER_DEFS_H_ */
|
||||
|
32
slsDetectorSoftware/eigerDetectorServer/updateGitVersion.sh
Executable file
32
slsDetectorSoftware/eigerDetectorServer/updateGitVersion.sh
Executable file
@ -0,0 +1,32 @@
|
||||
SERVER=eigerDetectorServer
|
||||
MAINDIR=slsDetectorsPackage
|
||||
SPECDIR=slsDetectorSoftware/$SERVER
|
||||
TMPFILE=gitInfoEigerTmp.h
|
||||
INCLFILE=gitInfoEiger.h
|
||||
|
||||
#evaluate the variables
|
||||
EVALFILE=../../evalVersionVariables.sh
|
||||
source $EVALFILE
|
||||
|
||||
|
||||
#get modified date
|
||||
#RDATE1='git log --pretty=format:"%ci" -1'
|
||||
RDATE1="find ../slsDetectorServer . -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | egrep -v 'gitInfo|bin|.git|updateGitVersion|.o' | head -n 1"
|
||||
RDATE=`eval $RDATE1`
|
||||
NEWDATE=$(sed "s/-//g" <<< $RDATE | awk '{print $1;}')
|
||||
NEWDATE=${NEWDATE/#/0x}
|
||||
|
||||
|
||||
#get old date from INCLFILE
|
||||
OLDDATE=$(more $INCLFILE | grep '#define SVNDATE' | awk '{print $3}')
|
||||
|
||||
|
||||
#update INCLFILE if changes
|
||||
if [ "$OLDDATE" != "$NEWDATE" ]; then
|
||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
||||
cd ../../
|
||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
||||
cd $WD
|
||||
fi
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repsitory UUID: a5b59b47430913bb461b50da05b553874b33f39a
|
||||
Revision: 1418
|
||||
Branch: developer
|
||||
Repsitory UUID: 2dfbd9016b501eca6ee2c00a08e49a3f7e7990d8
|
||||
Revision: 1452
|
||||
Branch: 3.0-rc
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 1418
|
||||
Last Changed Date: 2017-06-22 14:32:24 +0200
|
||||
Last Changed Rev: 1457
|
||||
Last Changed Date: 2017-08-09 11:36:51.000000002 +0200 ./multiSlsDetector/multiSlsDetector.cpp
|
||||
|
1
slsDetectorSoftware/gotthardDetectorServer/AD9257.h
Symbolic link
1
slsDetectorSoftware/gotthardDetectorServer/AD9257.h
Symbolic link
@ -0,0 +1 @@
|
||||
../slsDetectorServer/AD9257.h
|
@ -16,17 +16,20 @@ INSTMODE= 0777
|
||||
|
||||
|
||||
BINS = testlib_sharedlibc
|
||||
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c trimming_funcs.c sharedmemory.c
|
||||
SRCS = server.c firmware_funcs.c server_funcs.c communication_funcs.c mcb_funcs.c trimming_funcs.c sharedmemory.c
|
||||
OBJS = $(SRCS:%.c=%.o)
|
||||
|
||||
|
||||
|
||||
all: clean $(PROGS)
|
||||
all: clean versioning $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
versioning:
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
echo $(OBJS)
|
||||
# echo $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
|
||||
|
||||
|
||||
@ -45,4 +48,3 @@ clean:
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -27,6 +27,7 @@ boot: $(OBJS)
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
echo $(OBJS)
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
|
||||
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
../slsDetectorServer/commonServerFunctions.h
|
20
slsDetectorSoftware/gotthardDetectorServer/config.txt
Normal file
20
slsDetectorSoftware/gotthardDetectorServer/config.txt
Normal file
@ -0,0 +1,20 @@
|
||||
#masterflags (no_master, is_master, is_slave)
|
||||
masterflags no_master
|
||||
|
||||
#master default delay
|
||||
masterdefaultdelay 70
|
||||
|
||||
#patternphase
|
||||
patternphase 0
|
||||
|
||||
#adcphase
|
||||
adcphase 0
|
||||
|
||||
#slave pattern phase
|
||||
slavepatternphase 0
|
||||
|
||||
#slave adc phase
|
||||
slaveadcphase 0
|
||||
|
||||
#rst to sw1 delay
|
||||
rsttosw1delay 2
|
@ -4,6 +4,8 @@
|
||||
#include "mcb_funcs.h"
|
||||
#include "registers_g.h"
|
||||
|
||||
#include "AD9257.h" // include "commonServerFunctions.h"
|
||||
|
||||
#ifdef SHAREDMEMORY
|
||||
#include "sharedmemory.h"
|
||||
#endif
|
||||
@ -15,6 +17,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
//for memory mapping
|
||||
u_int64_t CSP0BASE;
|
||||
|
||||
@ -53,6 +56,16 @@ int masterMode=NO_MASTER, syncMode=NO_SYNCHRONIZATION, timingMode=AUTO_TIMING;
|
||||
enum externalSignalFlag signals[4]={EXT_SIG_OFF, EXT_SIG_OFF, EXT_SIG_OFF, EXT_SIG_OFF};
|
||||
|
||||
|
||||
//for the 25um detectors
|
||||
int masterflags = NO_MASTER;
|
||||
int masterdefaultdelay = 62;
|
||||
int patternphase = 0;
|
||||
int adcphase = 0;
|
||||
int slavepatternphase = 0;
|
||||
int slaveadcphase = 0;
|
||||
int rsttosw1delay = 2;
|
||||
|
||||
|
||||
#ifdef MCB_FUNCS
|
||||
extern const int nChans;
|
||||
extern const int nChips;
|
||||
@ -228,6 +241,134 @@ u_int32_t bus_r(u_int32_t offset) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
void setMasterSlaveConfiguration(){
|
||||
|
||||
/*
|
||||
int masterflags = NO_MASTER;
|
||||
int masterdefaultdelay = 62;
|
||||
int patternphase = 0;
|
||||
int adcphase = 0;
|
||||
int slavepatternphase = 0;
|
||||
int slaveadcphase = 0;
|
||||
int sw1torstdelay = 2;
|
||||
*/
|
||||
// global master default delay picked from config file
|
||||
FILE* fd=fopen(CONFIG_FILE,"r");
|
||||
if(fd==NULL){
|
||||
cprintf(RED,"\nWarning: Could not open file\n");
|
||||
return;
|
||||
}
|
||||
cprintf(BLUE,"config file %s opened\n", CONFIG_FILE);
|
||||
|
||||
char key[256];
|
||||
char value[256];
|
||||
char line[256];
|
||||
int ival=0;
|
||||
u_int32_t val=0;
|
||||
|
||||
while (fgets(line, sizeof(line), fd)) {
|
||||
if(line[0] == '#')
|
||||
continue;
|
||||
sscanf(line, "%s %s\n", key, value);
|
||||
if (!strcasecmp(key,"masterflags")) {
|
||||
if (!strcasecmp(value,"is_master")) {
|
||||
masterflags = IS_MASTER;
|
||||
}
|
||||
else if (!strcasecmp(value,"is_slave")) {
|
||||
masterflags = IS_SLAVE;
|
||||
}
|
||||
else if (!strcasecmp(value,"no_master")){
|
||||
masterflags = NO_MASTER;
|
||||
}
|
||||
else {
|
||||
cprintf(RED,"could not scan masterflags %s value from config file\n",value);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(sscanf(value,"%d",&ival)<=0) {
|
||||
cprintf(RED,"could not scan patternphase %s value from config file\n",value);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!strcasecmp(key,"masterdefaultdelay"))
|
||||
masterdefaultdelay = ival;
|
||||
else if (!strcasecmp(key,"patternphase"))
|
||||
patternphase = ival;
|
||||
else if (!strcasecmp(key,"adcphase"))
|
||||
adcphase = ival;
|
||||
else if (!strcasecmp(key,"slavepatternphase"))
|
||||
slavepatternphase = ival;
|
||||
else if (!strcasecmp(key,"slaveadcphase"))
|
||||
slaveadcphase = ival;
|
||||
else if (!strcasecmp(key,"rsttosw1delay"))
|
||||
rsttosw1delay = ival;
|
||||
else {
|
||||
cprintf(RED,"could not scan parameter name %s from config file\n",key);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
cprintf(BLUE, "masterflags: %d\n"
|
||||
"masterdefaultdelay:%d\n"
|
||||
"patternphase:%d\n"
|
||||
"adcphase:%d\n"
|
||||
"slavepatternphase:%d\n"
|
||||
"slaveadcphase:%d\n"
|
||||
"rsttosw1delay:%d\n",
|
||||
masterflags,
|
||||
masterdefaultdelay,
|
||||
patternphase,
|
||||
adcphase,
|
||||
slavepatternphase,
|
||||
slaveadcphase,
|
||||
rsttosw1delay);
|
||||
|
||||
|
||||
|
||||
if (masterflags == IS_MASTER) {
|
||||
// set delay
|
||||
setDelay(0);
|
||||
|
||||
/* Set pattern phase for the master module */
|
||||
val=bus_r(MULTI_PURPOSE_REG);
|
||||
val = (val & (~(PLL_CLK_SEL_MSK))) | PLL_CLK_SEL_MASTER_VAL;
|
||||
bus_w(MULTI_PURPOSE_REG,val);
|
||||
setPhaseShift(patternphase);
|
||||
/* Set adc phase for the master module */
|
||||
val=bus_r(MULTI_PURPOSE_REG);
|
||||
val = (val & (~(PLL_CLK_SEL_MSK))) | PLL_CLK_SEL_MASTER_ADC_VAL;
|
||||
bus_w(MULTI_PURPOSE_REG,val);
|
||||
setPhaseShift(adcphase);
|
||||
/* Set pattern phase for the slave module */
|
||||
val=bus_r(MULTI_PURPOSE_REG);
|
||||
val = (val & (~(PLL_CLK_SEL_MSK))) | PLL_CLK_SEL_SLAVE_VAL;
|
||||
bus_w(MULTI_PURPOSE_REG,val);
|
||||
setPhaseShift(slavepatternphase);
|
||||
/* Set adc phase for the slave module */
|
||||
val=bus_r(MULTI_PURPOSE_REG);
|
||||
val = (val & (~(PLL_CLK_SEL_MSK))) | PLL_CLK_SEL_SLAVE_ADC_VAL;
|
||||
bus_w(MULTI_PURPOSE_REG,val);
|
||||
setPhaseShift(slaveadcphase);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (masterflags == IS_MASTER || masterflags == IS_SLAVE) {
|
||||
val=bus_r(MULTI_PURPOSE_REG);
|
||||
//#ifdef VERBOSE
|
||||
printf("Value of multipurpose reg:%d\n",bus_r(MULTI_PURPOSE_REG));
|
||||
//#endif
|
||||
val = (val & (~(RST_TO_SW1_DELAY_MSK))) | ((rsttosw1delay << RST_TO_SW1_DELAY_OFFSET) & (RST_TO_SW1_DELAY_MSK));
|
||||
bus_w(MULTI_PURPOSE_REG,val);
|
||||
}
|
||||
|
||||
fclose(fd);
|
||||
}
|
||||
|
||||
|
||||
int setPhaseShiftOnce(){
|
||||
u_int32_t addr, reg;
|
||||
int i;
|
||||
@ -256,6 +397,31 @@ int setPhaseShiftOnce(){
|
||||
}
|
||||
|
||||
|
||||
int setPhaseShift(int numphaseshift){
|
||||
u_int32_t addr, reg;
|
||||
int i;
|
||||
addr=MULTI_PURPOSE_REG;
|
||||
reg=bus_r(addr);
|
||||
#ifdef VERBOSE
|
||||
printf("Multipurpose reg:%x\n",reg);
|
||||
#endif
|
||||
|
||||
printf("\nImplementing phase shift of %d\n",numphaseshift);
|
||||
for (i=0;i<numphaseshift;i++) {
|
||||
bus_w(addr,reg | PHASE_STEP_BIT);
|
||||
bus_w(addr,reg & (~PHASE_STEP_BIT));
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Multipupose reg now:%x\n",bus_r(addr));
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int cleanFifo(){
|
||||
u_int32_t addr, reg, val;
|
||||
@ -889,8 +1055,16 @@ int64_t getFrames(){
|
||||
|
||||
int64_t setExposureTime(int64_t value){
|
||||
/* time is in ns */
|
||||
if (value!=-1)
|
||||
value*=(1E-9*CLK_FREQ);
|
||||
if (value!=-1) {
|
||||
double actualvalue = value*(1E-9*CLK_FREQ);
|
||||
value*=(1E-9*CLK_FREQ);
|
||||
if(fabs(actualvalue-value)>= 0.5){
|
||||
if(actualvalue > value)
|
||||
value++;
|
||||
else
|
||||
value--;
|
||||
}
|
||||
}
|
||||
return set64BitReg(value,SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG)/(1E-9*CLK_FREQ);
|
||||
}
|
||||
|
||||
@ -909,7 +1083,14 @@ int64_t getGates(){
|
||||
int64_t setPeriod(int64_t value){
|
||||
/* time is in ns */
|
||||
if (value!=-1) {
|
||||
value*=(1E-9*CLK_FREQ);
|
||||
double actualvalue = value*(1E-9*CLK_FREQ);
|
||||
value*=(1E-9*CLK_FREQ);
|
||||
if(fabs(actualvalue-value)>= 0.5){
|
||||
if(actualvalue > value)
|
||||
value++;
|
||||
else
|
||||
value--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -924,9 +1105,26 @@ int64_t getPeriod(){
|
||||
int64_t setDelay(int64_t value){
|
||||
/* time is in ns */
|
||||
if (value!=-1) {
|
||||
value*=(1E-9*CLK_FREQ);
|
||||
if (masterflags == IS_MASTER) {
|
||||
value += masterdefaultdelay;
|
||||
cprintf(BLUE,"Actual delay for master: %lld\n", (long long int) value);
|
||||
}
|
||||
double actualvalue = value*(1E-9*CLK_FREQ);
|
||||
value*=(1E-9*CLK_FREQ);
|
||||
if(fabs(actualvalue-value)>= 0.5){
|
||||
if(actualvalue > value)
|
||||
value++;
|
||||
else
|
||||
value--;
|
||||
}
|
||||
}
|
||||
return set64BitReg(value,SET_DELAY_LSB_REG, SET_DELAY_MSB_REG)/(1E-9*CLK_FREQ);
|
||||
int64_t retval = set64BitReg(value,SET_DELAY_LSB_REG, SET_DELAY_MSB_REG)/(1E-9*CLK_FREQ);
|
||||
if (masterflags == IS_MASTER) {
|
||||
cprintf(BLUE,"Actual delay read from master: %lld\n", (long long int) retval);
|
||||
retval -= masterdefaultdelay;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t getDelay(){
|
||||
@ -1255,7 +1453,7 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
|
||||
tse_conf *tse_conf_regs;
|
||||
long int sum = 0;
|
||||
long int checksum;
|
||||
int count,val;
|
||||
int count;
|
||||
unsigned short *addr;
|
||||
|
||||
mac_conf_regs=(mac_conf*)(CSP0BASE+offset*2);
|
||||
@ -1265,35 +1463,40 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
|
||||
printf("***Configuring MAC*** \n");
|
||||
#endif
|
||||
|
||||
|
||||
if(ival)
|
||||
bus_w(addrr,(RESET_BIT|DIGITAL_TEST_BIT)); //0x080,reset mac (reset)
|
||||
bus_w(addrr, bus_r(addrr) | (RESET_BIT|DIGITAL_TEST_BIT)); //0x080,reset mac (reset)
|
||||
else
|
||||
bus_w(addrr,RESET_BIT); //0x080,reset mac (reset)
|
||||
val=bus_r(addrr);
|
||||
bus_w(addrr, bus_r(addrr) | RESET_BIT); //0x080,reset mac (reset)
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Value read from Multi-purpose Reg:%x\n",val);
|
||||
printf("Value read from Multi-purpose Reg:%x\n",bus_r(addrr));
|
||||
#endif
|
||||
// if(val!=0x080) return -1;
|
||||
|
||||
usleep(500000);
|
||||
|
||||
bus_w(addrr, bus_r(addrr) &(~ RESET_BIT));/* release reset */
|
||||
|
||||
if(ival)
|
||||
bus_w(addrr,(ENET_RESETN_BIT|WRITE_BACK_BIT|DIGITAL_TEST_BIT)); //0x840,write shadow regs(enet reset,write bak)
|
||||
bus_w(addrr, bus_r(addrr) | (ENET_RESETN_BIT|WRITE_BACK_BIT|DIGITAL_TEST_BIT)); //0x840,write shadow regs(enet reset,write bak)
|
||||
else
|
||||
bus_w(addrr,(ENET_RESETN_BIT|WRITE_BACK_BIT)); //0x840,write shadow regs(enet reset,write bak)
|
||||
val=bus_r(addrr);
|
||||
bus_w(addrr, bus_r(addrr) | (ENET_RESETN_BIT|WRITE_BACK_BIT)); //0x840,write shadow regs(enet reset,write bak)
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Value read from Multi-purpose Reg:%x\n",val);
|
||||
printf("Value read from Multi-purpose Reg:%x\n",bus_r(addrr));
|
||||
#endif
|
||||
// if(val!=0x840) return -1;
|
||||
|
||||
bus_w(addrr, bus_r(addrr) &(~WRITE_BACK_BIT));/* release write_back */
|
||||
|
||||
if(ival)
|
||||
bus_w(addrr,(ENET_RESETN_BIT|DIGITAL_TEST_BIT)); //0x800,nreset phy(enet reset)
|
||||
bus_w(addrr, bus_r(addrr) | (ENET_RESETN_BIT|DIGITAL_TEST_BIT)); //0x800,nreset phy(enet reset)
|
||||
else
|
||||
bus_w(addrr,ENET_RESETN_BIT); //0x800,nreset phy(enet reset)
|
||||
val=bus_r(addrr);
|
||||
bus_w(addrr, bus_r(addrr) | ENET_RESETN_BIT); //0x800,nreset phy(enet reset)
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Value read from Multi-purpose Reg:%x\n",val);
|
||||
printf("Value read from Multi-purpose Reg:%x\n",bus_r(addrr));
|
||||
#endif
|
||||
// if(val!=0x800) return -1;
|
||||
|
||||
@ -1398,26 +1601,26 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
|
||||
|
||||
|
||||
if(ival)
|
||||
bus_w(addrr,(INT_RSTN_BIT|ENET_RESETN_BIT|WRITE_BACK_BIT|DIGITAL_TEST_BIT)); //0x2840,write shadow regs..
|
||||
bus_w(addrr, bus_r(addrr) | (INT_RSTN_BIT|ENET_RESETN_BIT|WRITE_BACK_BIT|DIGITAL_TEST_BIT)); //0x2840,write shadow regs..
|
||||
else
|
||||
bus_w(addrr,(INT_RSTN_BIT|ENET_RESETN_BIT|WRITE_BACK_BIT)); //0x2840,write shadow regs..
|
||||
bus_w(addrr, bus_r(addrr) | (INT_RSTN_BIT|ENET_RESETN_BIT|WRITE_BACK_BIT)); //0x2840,write shadow regs..
|
||||
|
||||
val=bus_r(addrr);
|
||||
#ifdef VERBOSE
|
||||
printf("Value read from Multi-purpose Reg:%x\n",val);
|
||||
printf("Value read from Multi-purpose Reg:%x\n",bus_r(addrr));
|
||||
#endif
|
||||
// if(val!=0x2840) return -1;
|
||||
|
||||
usleep(100000);
|
||||
|
||||
if(ival)
|
||||
bus_w(addrr,(INT_RSTN_BIT|ENET_RESETN_BIT|SW1_BIT|DIGITAL_TEST_BIT)); //0x2820,write shadow regs..
|
||||
else
|
||||
bus_w(addrr,(INT_RSTN_BIT|ENET_RESETN_BIT|SW1_BIT)); //0x2820,write shadow regs..
|
||||
bus_w(addrr, bus_r(addrr) &(~WRITE_BACK_BIT));
|
||||
|
||||
if(ival)
|
||||
bus_w(addrr, bus_r(addrr) | (INT_RSTN_BIT|ENET_RESETN_BIT|SW1_BIT|DIGITAL_TEST_BIT)); //0x2820,write shadow regs..
|
||||
else
|
||||
bus_w(addrr, bus_r(addrr) | (INT_RSTN_BIT|ENET_RESETN_BIT|SW1_BIT)); //0x2820,write shadow regs..
|
||||
|
||||
val=bus_r(addrr);
|
||||
#ifdef VERBOSE
|
||||
printf("Value read from Multi-purpose Reg:%x\n",val);
|
||||
printf("Value read from Multi-purpose Reg:%x\n",bus_r(addrr));
|
||||
#endif
|
||||
// if(val!=0x2820) return -1;
|
||||
|
||||
@ -1814,7 +2017,9 @@ int allocateRAM() {
|
||||
|
||||
|
||||
}
|
||||
int prepareADC(){
|
||||
|
||||
|
||||
int configureADC(){
|
||||
printf("Preparing ADC\n");
|
||||
u_int32_t valw,codata,csmask;
|
||||
int i,j,cdx,ddx;
|
||||
@ -1834,26 +2039,26 @@ int prepareADC(){
|
||||
|
||||
// start point
|
||||
valw=0xff;
|
||||
bus_w(ADC_WRITE_REG,(valw));
|
||||
bus_w(ADC_SPI_REG,(valw));
|
||||
|
||||
//chip sel bar down
|
||||
valw=((0xffffffff&(~csmask)));
|
||||
bus_w(ADC_WRITE_REG,valw);
|
||||
bus_w(ADC_SPI_REG,valw);
|
||||
|
||||
for (i=0;i<24;i++) {
|
||||
//cldwn
|
||||
valw=valw&(~(0x1<<cdx));
|
||||
bus_w(ADC_WRITE_REG,valw);
|
||||
bus_w(ADC_SPI_REG,valw);
|
||||
usleep(0);
|
||||
|
||||
//write data (i)
|
||||
valw=(valw&(~(0x1<<ddx)))+(((codata>>(23-i))&0x1)<<ddx);
|
||||
bus_w(ADC_WRITE_REG,valw);
|
||||
bus_w(ADC_SPI_REG,valw);
|
||||
usleep(0);
|
||||
|
||||
//clkup
|
||||
valw=valw+(0x1<<cdx);
|
||||
bus_w(ADC_WRITE_REG,valw);
|
||||
bus_w(ADC_SPI_REG,valw);
|
||||
usleep(0);
|
||||
}
|
||||
|
||||
@ -1861,7 +2066,7 @@ int prepareADC(){
|
||||
valw=valw&(~(0x1<<cdx));
|
||||
usleep(0);
|
||||
valw=0xff;
|
||||
bus_w(ADC_WRITE_REG,(valw));
|
||||
bus_w(ADC_SPI_REG,(valw));
|
||||
|
||||
//usleep in between
|
||||
usleep(50000);
|
||||
@ -1872,19 +2077,19 @@ int prepareADC(){
|
||||
/*
|
||||
codata=0;
|
||||
codata=(0x14<<8)+(0x0); //command and value;
|
||||
valw=0xff; bus_w(ADC_WRITE_REG,(valw)); // start point
|
||||
valw=((0xffffffff&(~csmask)));bus_w(ADC_WRITE_REG,valw); //chip sel bar down
|
||||
valw=0xff; bus_w(ADC_SPI_REG,(valw)); // start point
|
||||
valw=((0xffffffff&(~csmask)));bus_w(ADC_SPI_REG,valw); //chip sel bar down
|
||||
for (i=0;i<24;i++) {
|
||||
valw=valw&(~(0x1<<cdx));bus_w(ADC_WRITE_REG,valw);usleep(0); //cldwn
|
||||
valw=valw&(~(0x1<<cdx));bus_w(ADC_SPI_REG,valw);usleep(0); //cldwn
|
||||
|
||||
valw=(valw&(~(0x1<<ddx)))+(((codata>>(23-i))&0x1)<<ddx); bus_w(ADC_WRITE_REG,valw); usleep(0); //write data (i)
|
||||
valw=(valw&(~(0x1<<ddx)))+(((codata>>(23-i))&0x1)<<ddx); bus_w(ADC_SPI_REG,valw); usleep(0); //write data (i)
|
||||
|
||||
valw=valw+(0x1<<cdx);bus_w(ADC_WRITE_REG,valw); usleep(0); //clkup
|
||||
valw=valw+(0x1<<cdx);bus_w(ADC_SPI_REG,valw); usleep(0); //clkup
|
||||
|
||||
}
|
||||
|
||||
valw=valw&(~(0x1<<cdx));usleep(0);
|
||||
valw=0xff; bus_w(ADC_WRITE_REG,(valw)); // stop point =start point
|
||||
valw=0xff; bus_w(ADC_SPI_REG,(valw)); // stop point =start point
|
||||
|
||||
|
||||
|
||||
@ -1892,36 +2097,36 @@ int prepareADC(){
|
||||
|
||||
codata=0;
|
||||
codata=(0x08<<8)+(0x3); //command and value;Power modes(global) reset
|
||||
valw=0xff; bus_w(ADC_WRITE_REG,(valw)); // start point
|
||||
valw=((0xffffffff&(~csmask)));bus_w(ADC_WRITE_REG,valw); //chip sel bar down
|
||||
valw=0xff; bus_w(ADC_SPI_REG,(valw)); // start point
|
||||
valw=((0xffffffff&(~csmask)));bus_w(ADC_SPI_REG,valw); //chip sel bar down
|
||||
for (i=0;i<24;i++) {
|
||||
valw=valw&(~(0x1<<cdx));bus_w(ADC_WRITE_REG,valw);usleep(0); //cldwn
|
||||
valw=valw&(~(0x1<<cdx));bus_w(ADC_SPI_REG,valw);usleep(0); //cldwn
|
||||
|
||||
valw=(valw&(~(0x1<<ddx)))+(((codata>>(23-i))&0x1)<<ddx); bus_w(ADC_WRITE_REG,valw); usleep(0); //write data (i)
|
||||
valw=valw+(0x1<<cdx);bus_w(ADC_WRITE_REG,valw); usleep(0); //clkup
|
||||
valw=(valw&(~(0x1<<ddx)))+(((codata>>(23-i))&0x1)<<ddx); bus_w(ADC_SPI_REG,valw); usleep(0); //write data (i)
|
||||
valw=valw+(0x1<<cdx);bus_w(ADC_SPI_REG,valw); usleep(0); //clkup
|
||||
|
||||
}
|
||||
|
||||
valw=valw&(~(0x1<<cdx));usleep(0);
|
||||
valw=0xff; bus_w(ADC_WRITE_REG,(valw)); // stop point =start point
|
||||
valw=0xff; bus_w(ADC_SPI_REG,(valw)); // stop point =start point
|
||||
|
||||
|
||||
|
||||
usleep(50000);
|
||||
codata=0;
|
||||
codata=(0x08<<8)+(0x0); //command and value;Power modes(global) reset
|
||||
valw=0xff; bus_w(ADC_WRITE_REG,(valw)); // start point
|
||||
valw=((0xffffffff&(~csmask)));bus_w(ADC_WRITE_REG,valw); //chip sel bar down
|
||||
valw=0xff; bus_w(ADC_SPI_REG,(valw)); // start point
|
||||
valw=((0xffffffff&(~csmask)));bus_w(ADC_SPI_REG,valw); //chip sel bar down
|
||||
for (i=0;i<24;i++) {
|
||||
valw=valw&(~(0x1<<cdx));bus_w(ADC_WRITE_REG,valw);usleep(0); //cldwn
|
||||
valw=valw&(~(0x1<<cdx));bus_w(ADC_SPI_REG,valw);usleep(0); //cldwn
|
||||
|
||||
valw=(valw&(~(0x1<<ddx)))+(((codata>>(23-i))&0x1)<<ddx); bus_w(ADC_WRITE_REG,valw); usleep(0); //write data (i)
|
||||
valw=valw+(0x1<<cdx);bus_w(ADC_WRITE_REG,valw); usleep(0); //clkup
|
||||
valw=(valw&(~(0x1<<ddx)))+(((codata>>(23-i))&0x1)<<ddx); bus_w(ADC_SPI_REG,valw); usleep(0); //write data (i)
|
||||
valw=valw+(0x1<<cdx);bus_w(ADC_SPI_REG,valw); usleep(0); //clkup
|
||||
|
||||
}
|
||||
|
||||
valw=valw&(~(0x1<<cdx));usleep(0);
|
||||
valw=0xff; bus_w(ADC_WRITE_REG,(valw)); // stop point =start point
|
||||
valw=0xff; bus_w(ADC_SPI_REG,(valw)); // stop point =start point
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,9 @@ u_int16_t bus_w16(u_int32_t offset, u_int16_t data);//aldos function
|
||||
u_int32_t bus_w(u_int32_t offset, u_int32_t data);
|
||||
u_int32_t bus_r(u_int32_t offset);
|
||||
|
||||
void setMasterSlaveConfiguration();
|
||||
int setPhaseShiftOnce();
|
||||
int setPhaseShift(int numphaseshift);
|
||||
int cleanFifo();
|
||||
int setDAQRegister();
|
||||
|
||||
@ -139,6 +141,7 @@ int allocateRAM();
|
||||
int clearRAM();
|
||||
|
||||
|
||||
|
||||
int setMaster(int f);
|
||||
int setSynchronization(int s);
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/gotthardDetectorServer
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repsitory UUID: 8aceb5d4b0ca6bd95a11b53e7a799b463b92d51b
|
||||
Revision: 197
|
||||
Repsitory UUID: a0ae3985068425e7142df8271eac6ce09a238dc9
|
||||
Revision: 206
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 334
|
||||
Last Changed Date: 2016-08-12 11:08:03 +0200
|
||||
Last Changed Rev: 1454
|
||||
Last Changed Date: 2017-08-04 09:28:44.000000002 +0200 ./firmware_funcs.c
|
||||
|
@ -1,11 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/gotthardDetectorServer"
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "8aceb5d4b0ca6bd95a11b53e7a799b463b92d51b"
|
||||
//#define SVNREV 0x334
|
||||
#define SVNREPUUID "a0ae3985068425e7142df8271eac6ce09a238dc9"
|
||||
//#define SVNREV 0x1454
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "Dhanya_Maliakal"
|
||||
#define SVNREV 0x334
|
||||
#define SVNDATE 0x20160812
|
||||
#define SVNREV 0x1454
|
||||
#define SVNDATE 0x20170804
|
||||
//
|
||||
|
Binary file not shown.
BIN
slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv3.0.0.4
Executable file
BIN
slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv3.0.0.4
Executable file
Binary file not shown.
@ -33,7 +33,16 @@
|
||||
//#define TIME_FROM_START_REG 0x16<<11
|
||||
#define MCB_CNTRL_REG_OFF 0x17<<11// control the dacs
|
||||
//ADC
|
||||
#define ADC_WRITE_REG 0x18<<11
|
||||
#define ADC_SPI_REG 0x18<<11
|
||||
|
||||
#define ADC_SERIAL_CLK_OUT_OFST (0)
|
||||
#define ADC_SERIAL_CLK_OUT_MSK (0x00000001 << ADC_SERIAL_CLK_OUT_OFST)
|
||||
#define ADC_SERIAL_DATA_OUT_OFST (1)
|
||||
#define ADC_SERIAL_DATA_OUT_MSK (0x00000001 << ADC_SERIAL_DATA_OUT_OFST)
|
||||
#define ADC_SERIAL_CS_OUT_OFST (2)
|
||||
#define ADC_SERIAL_CS_OUT_MSK (0x0000000F << ADC_SERIAL_CS_OUT_OFST)
|
||||
|
||||
|
||||
#define ADC_SYNC_REG 0x19<<11
|
||||
//#define MUTIME_REG 0x1a<<11
|
||||
//temperature
|
||||
@ -265,14 +274,22 @@
|
||||
#define WRITE_BACK_OFFSET 6
|
||||
#define RESET_BIT 0x00000080
|
||||
#define RESET_OFFSET 7
|
||||
#define PLL_CLK_SEL_MSK 0x00000700
|
||||
#define PLL_CLK_SEL_OFFSET 8
|
||||
#define PLL_CLK_SEL_MASTER_VAL ((0x1 << PLL_CLK_SEL_OFFSET) & PLL_CLK_SEL_MSK)
|
||||
#define PLL_CLK_SEL_MASTER_ADC_VAL ((0x2 << PLL_CLK_SEL_OFFSET) & PLL_CLK_SEL_MSK)
|
||||
#define PLL_CLK_SEL_SLAVE_VAL ((0x3 << PLL_CLK_SEL_OFFSET) & PLL_CLK_SEL_MSK)
|
||||
#define PLL_CLK_SEL_SLAVE_ADC_VAL ((0x4 << PLL_CLK_SEL_OFFSET) & PLL_CLK_SEL_MSK)
|
||||
#define ENET_RESETN_BIT 0x00000800
|
||||
#define ENET_RESETN_OFFSET 11
|
||||
#define INT_RSTN_BIT 0x00002000
|
||||
#define INT_RSTN_OFFSET 13
|
||||
#define INT_RSTN_BIT 0x00001000
|
||||
#define INT_RSTN_OFFSET 12
|
||||
#define DIGITAL_TEST_BIT 0x00004000
|
||||
#define DIGITAL_TEST_OFFSET 14
|
||||
//#define CHANGE_AT_POWER_ON_BIT 0x00008000
|
||||
//#define CHANGE_AT_POWER_ON_OFFSET 15
|
||||
#define RST_TO_SW1_DELAY_MSK 0x000F0000
|
||||
#define RST_TO_SW1_DELAY_OFFSET 16
|
||||
|
||||
|
||||
/* settings/conf gain register */
|
||||
|
@ -24,6 +24,10 @@
|
||||
|
||||
#define NCHIPS_PER_ADC 2
|
||||
|
||||
// for 25 um
|
||||
#define CONFIG_FILE "config.txt"
|
||||
|
||||
|
||||
//#define TRIM_DR ((2**NTRIMBITS)-1)
|
||||
//#define COUNT_DR ((2**NCOUNTBITS)-1)
|
||||
#define TRIM_DR (((int)pow(2,NTRIMBITS))-1)
|
||||
|
@ -84,7 +84,7 @@ int init_detector( int b) {
|
||||
|
||||
//gotthard specific
|
||||
setPhaseShiftOnce();
|
||||
prepareADC();
|
||||
configureADC();
|
||||
setADC(-1); //already does setdaqreg and clean fifo
|
||||
setSettings(GET_SETTINGS,-1);
|
||||
|
||||
@ -99,6 +99,7 @@ int init_detector( int b) {
|
||||
setMaster(GET_MASTER);
|
||||
setSynchronization(GET_SYNCHRONIZATION_MODE);
|
||||
startReceiver(0);
|
||||
setMasterSlaveConfiguration();
|
||||
}
|
||||
strcpy(mess,"dummy message");
|
||||
strcpy(lastClientIP,"none");
|
||||
@ -192,6 +193,7 @@ int function_table() {
|
||||
flist[F_PREPARE_ACQUISITION]=&start_receiver;
|
||||
flist[F_CLEANUP_ACQUISITION]=&stop_receiver;
|
||||
flist[F_CALIBRATE_PEDESTAL]=&calibrate_pedestal;
|
||||
flist[F_WRITE_ADC_REG]=&write_adc_register;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -3055,3 +3057,54 @@ int calibrate_pedestal(int file_des){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int write_adc_register(int file_des) {
|
||||
int ret=OK;
|
||||
int n=0;
|
||||
int retval=-1;
|
||||
sprintf(mess,"write to adc register failed\n");
|
||||
|
||||
// receive arguments
|
||||
int arg[2]={-1,-1};
|
||||
n = receiveData(file_des,arg,sizeof(arg),INT32);
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
int addr=arg[0];
|
||||
int val=arg[1];
|
||||
|
||||
// execute action
|
||||
if (ret == OK) {
|
||||
if (differentClients && lockStatus) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
}
|
||||
else {
|
||||
#ifdef VERBOSE
|
||||
printf("writing to register 0x%x data 0x%x\n", addr, val);
|
||||
#endif
|
||||
setAdc(addr,val);
|
||||
#ifdef VERBOSE
|
||||
printf("Data set to 0x%x\n", retval);
|
||||
#endif
|
||||
if (ret==OK && differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
}
|
||||
// send ok / fail
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
// send return argument
|
||||
if (ret==FAIL) {
|
||||
n = sendDataOnly(file_des,mess,sizeof(mess));
|
||||
} else
|
||||
n = sendDataOnly(file_des,&retval,sizeof(retval));
|
||||
|
||||
// return ok / fail
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,7 +69,7 @@ int set_dynamic_range(int);
|
||||
int set_roi(int);
|
||||
int get_roi(int);
|
||||
int set_speed(int);
|
||||
void prepareADC(void);
|
||||
void configureADC();
|
||||
int set_readout_flags(int);
|
||||
int execute_trimming(int);
|
||||
int lock_server(int);
|
||||
@ -94,4 +94,6 @@ int calibrate_pedestal(int);
|
||||
|
||||
int set_roi(int);
|
||||
|
||||
int write_adc_register(int);
|
||||
|
||||
#endif
|
||||
|
30
slsDetectorSoftware/gotthardDetectorServer/updateGitVersion.sh
Executable file
30
slsDetectorSoftware/gotthardDetectorServer/updateGitVersion.sh
Executable file
@ -0,0 +1,30 @@
|
||||
SERVER=gotthardDetectorServer
|
||||
MAINDIR=slsDetectorsPackage
|
||||
SPECDIR=slsDetectorSoftware/$SERVER
|
||||
TMPFILE=gitInfoGotthardTmp.h
|
||||
INCLFILE=gitInfoGotthard.h
|
||||
|
||||
#evaluate the variables
|
||||
EVALFILE=../../evalVersionVariables.sh
|
||||
source $EVALFILE
|
||||
|
||||
|
||||
#get modified date
|
||||
#RDATE1='git log --pretty=format:"%ci" -1'
|
||||
RDATE1="find . -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | egrep -v 'gitInfo|.git|updateGitVersion|.o' | head -n 1"
|
||||
RDATE=`eval $RDATE1`
|
||||
NEWDATE=$(sed "s/-//g" <<< $RDATE | awk '{print $1;}')
|
||||
NEWDATE=${NEWDATE/#/0x}
|
||||
|
||||
|
||||
#get old date from INCLFILE
|
||||
OLDDATE=$(more $INCLFILE | grep '#define SVNDATE' | awk '{print $3}')
|
||||
|
||||
|
||||
#update INCLFILE if changes
|
||||
if [ "$OLDDATE" != "$NEWDATE" ]; then
|
||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
||||
cd ../../
|
||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
||||
cd $WD
|
||||
fi
|
@ -22,12 +22,15 @@ OBJS = $(SRCS:%.c=%.o)
|
||||
|
||||
|
||||
|
||||
all: clean $(PROGS)
|
||||
all: clean versioning $(PROGS)
|
||||
|
||||
test: clean jungfrauADCTEst
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
versioning:
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
||||
|
||||
jungfrauDetectorServerTest: $(OBJS)
|
||||
echo $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
|
||||
|
31
slsDetectorSoftware/jctbDetectorServer/updateGitVersion.sh
Executable file
31
slsDetectorSoftware/jctbDetectorServer/updateGitVersion.sh
Executable file
@ -0,0 +1,31 @@
|
||||
SERVER=jctbDetectorServer
|
||||
MAINDIR=slsDetectorsPackage
|
||||
SPECDIR=slsDetectorSoftware/$SERVER
|
||||
TMPFILE=gitInfoMoenchTmp.h
|
||||
INCLFILE=gitInfoMoench.h
|
||||
|
||||
|
||||
#evaluate the variables
|
||||
EVALFILE=../../evalVersionVariables.sh
|
||||
source $EVALFILE
|
||||
|
||||
|
||||
#get modified date
|
||||
#RDATE1='git log --pretty=format:"%ci" -1'
|
||||
RDATE1="find . -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | egrep -v 'gitInfo|.git|updateGitVersion|.o' | head -n 1"
|
||||
RDATE=`eval $RDATE1`
|
||||
NEWDATE=$(sed "s/-//g" <<< $RDATE | awk '{print $1;}')
|
||||
NEWDATE=${NEWDATE/#/0x}
|
||||
|
||||
|
||||
#get old date from INCLFILE
|
||||
OLDDATE=$(more $INCLFILE | grep '#define SVNDATE' | awk '{print $3}')
|
||||
|
||||
|
||||
#update INCLFILE if changes
|
||||
if [ "$OLDDATE" != "$NEWDATE" ]; then
|
||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
||||
cd ../../
|
||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
||||
cd $WD
|
||||
fi
|
@ -10,12 +10,15 @@ INSTMODE = 0777
|
||||
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
|
||||
OBJS = $(SRC_CLNT:.c=.o)
|
||||
|
||||
all: clean $(PROGS)
|
||||
all: clean versioning $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
versioning:
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
echo $(OBJS)
|
||||
# echo $(OBJS)
|
||||
mkdir -p $(DESTDIR)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
|
||||
mv $(PROGS) $(DESTDIR)
|
||||
@ -24,3 +27,5 @@ $(PROGS): $(OBJS)
|
||||
clean:
|
||||
rm -rf $(DESTDIR)/$(PROGS) *.o
|
||||
|
||||
|
||||
|
@ -83,7 +83,13 @@
|
||||
#define GET_PERIOD_MSB_REG (0x19 << 11)
|
||||
|
||||
/** Get Temperature Carlos, incorrectl as get gates */
|
||||
#define GET_TEMPERATURE_TMP112_REG (0x1c << 11) // in 10ths of millidegrees of TMP112
|
||||
#define GET_TEMPERATURE_TMP112_REG (0x1c << 11) // (after multiplying by 625) in 10ths of millidegrees of TMP112
|
||||
|
||||
#define TEMPERATURE_POLARITY_BIT (15)
|
||||
#define TEMPERATURE_POLARITY_MSK (0x00000001 << TEMPERATURE_POLARITY_BIT)
|
||||
#define TEMPERATURE_VALUE_BIT (0)
|
||||
#define TEMPERATURE_VALUE_MSK (0x00007FFF << TEMPERATURE_VALUE_BIT)
|
||||
|
||||
|
||||
/* Get Frames from Start 64 bit register (frames from start Run Control) */
|
||||
#define FRAMES_FROM_START_PG_LSB_REG (0x24 << 11)
|
||||
|
Binary file not shown.
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/jungfrauDetectorServer
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repsitory UUID: 49f4f7295411e3dbcf00fd93ca821eb95e13771c
|
||||
Revision: 80
|
||||
Repsitory UUID: 9f1b82c18ab0893d65bfadeb646b8ea244614632
|
||||
Revision: 88
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 1411
|
||||
Last Changed Date: 2017-06-14 11:40:35 +0200
|
||||
Last Changed Rev: 1443
|
||||
Last Changed Date: 2017-07-10 10:40:23.000000002 +0200 ./Makefile
|
||||
|
@ -1,11 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/jungfrauDetectorServer"
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "49f4f7295411e3dbcf00fd93ca821eb95e13771c"
|
||||
//#define SVNREV 0x1411
|
||||
#define SVNREPUUID "9f1b82c18ab0893d65bfadeb646b8ea244614632"
|
||||
//#define SVNREV 0x1443
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "Dhanya_Maliakal"
|
||||
#define SVNREV 0x1411
|
||||
#define SVNDATE 0x20170614
|
||||
#define SVNREV 0x1443
|
||||
#define SVNDATE 0x20170710
|
||||
//
|
||||
|
@ -25,11 +25,11 @@ int32_t clkPhase[2] = {0, 0};
|
||||
|
||||
/* basic tests */
|
||||
|
||||
void checkFirmwareCompatibility(){
|
||||
void checkFirmwareCompatibility() {
|
||||
|
||||
defineGPIOpins();
|
||||
resetFPGA();
|
||||
if ((mapCSP0() == FAIL) || (checkType() == FAIL) || (testFpga() == FAIL) || (testBus() == FAIL) ) {
|
||||
if ((mapCSP0() == FAIL) || (checkType() == FAIL) || (testFpga() == FAIL) || (testBus() == FAIL)) {
|
||||
cprintf(BG_RED, "Dangerous to continue. Goodbye!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@ -838,34 +838,25 @@ void setDAC(enum DACINDEX ind, int val, int imod, int mV, int retval[]){
|
||||
|
||||
|
||||
int getADC(enum ADCINDEX ind, int imod){
|
||||
|
||||
char tempnames[2][40]={"VRs/FPGAs Temperature", "ADCs/ASICs Temperature"};
|
||||
printf("Getting Temperature for %s\n",tempnames[ind]);
|
||||
u_int32_t addr = GET_TEMPERATURE_TMP112_REG;
|
||||
int retval = -1;
|
||||
/*
|
||||
u_int32_t val = 0;
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 10; i++) {
|
||||
switch((int)ind){
|
||||
uint32_t regvalue = bus_r(addr);
|
||||
uint32_t value = regvalue & TEMPERATURE_VALUE_MSK;
|
||||
double retval = value;
|
||||
|
||||
case TEMP_FPGA:
|
||||
val = (val<<1) + ((bus_r(addr) & (2)) >> 1);
|
||||
break;
|
||||
case TEMP_ADC:
|
||||
val= (val<<1) + (bus_r(addr) & (1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
// negative
|
||||
if (regvalue & TEMPERATURE_POLARITY_MSK) {
|
||||
// 2s complement
|
||||
int ret = (~value) + 1;
|
||||
// attach negative sign
|
||||
ret = 0 - value;
|
||||
retval = ret;
|
||||
}
|
||||
// or just read it
|
||||
retval = ((int)val) / 4.0;
|
||||
|
||||
printf("Temperature %s: %d °C\n",tempnames[ind],retval);*/
|
||||
printf("\nReal Temperature %s: %d °C\n",tempnames[ind],bus_r(addr));
|
||||
|
||||
|
||||
// conversion
|
||||
retval *= 625.0/10.0;
|
||||
printf("\nReal Temperature %s: %f °C\n",tempnames[ind],retval/1000.00);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -1303,8 +1294,8 @@ int calculateDataBytes(){
|
||||
return DATA_BYTES;
|
||||
}
|
||||
|
||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerModule() * (int)getTotalNumberOfModules);}
|
||||
int getTotalNumberOfChips(){return ((int)getNumberOfChipsPerModule * (int)getTotalNumberOfModules);}
|
||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerModule() * (int)getTotalNumberOfModules());}
|
||||
int getTotalNumberOfChips(){return ((int)getNumberOfChipsPerModule() * (int)getTotalNumberOfModules());}
|
||||
int getTotalNumberOfModules(){return NMOD;}
|
||||
int getNumberOfChannelsPerModule(){return ((int)getNumberOfChannelsPerChip() * (int)getTotalNumberOfChips());}
|
||||
int getNumberOfChipsPerModule(){return NCHIP;}
|
||||
|
31
slsDetectorSoftware/jungfrauDetectorServer/updateGitVersion.sh
Executable file
31
slsDetectorSoftware/jungfrauDetectorServer/updateGitVersion.sh
Executable file
@ -0,0 +1,31 @@
|
||||
SERVER=jungfrauDetectorServer
|
||||
MAINDIR=slsDetectorsPackage
|
||||
SPECDIR=slsDetectorSoftware/$SERVER
|
||||
TMPFILE=gitInfoJungfrauTmp.h
|
||||
INCLFILE=gitInfoJungfrau.h
|
||||
|
||||
|
||||
#evaluate the variables
|
||||
EVALFILE=../../evalVersionVariables.sh
|
||||
source $EVALFILE
|
||||
|
||||
|
||||
#get modified date
|
||||
#RDATE1='git log --pretty=format:"%ci" -1'
|
||||
RDATE1="find ../slsDetectorServer . -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | egrep -v 'gitInfo|bin|.git|updateGitVersion|.o' | head -n 1"
|
||||
RDATE=`eval $RDATE1`
|
||||
NEWDATE=$(sed "s/-//g" <<< $RDATE | awk '{print $1;}')
|
||||
NEWDATE=${NEWDATE/#/0x}
|
||||
|
||||
|
||||
#get old date from INCLFILE
|
||||
OLDDATE=$(more $INCLFILE | grep '#define SVNDATE' | awk '{print $3}')
|
||||
|
||||
|
||||
#update INCLFILE if changes
|
||||
if [ "$OLDDATE" != "$NEWDATE" ]; then
|
||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
||||
cd ../../
|
||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
||||
cd $WD
|
||||
fi
|
@ -21,10 +21,13 @@ OBJS = $(SRCS:%.c=%.o)
|
||||
|
||||
|
||||
|
||||
all: clean $(PROGS)
|
||||
all: clean versioning $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
versioning:
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
echo $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
|
||||
@ -40,7 +43,7 @@ romfs:
|
||||
|
||||
clean:
|
||||
rm -rf $(PROGS) *.o *.gdb
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/moenchDetectorServer
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/moenchDetectorServer
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repsitory UUID: 8aceb5d4b0ca6bd95a11b53e7a799b463b92d51b
|
||||
Revision: 80
|
||||
Repsitory UUID: 9f1b82c18ab0893d65bfadeb646b8ea244614632
|
||||
Revision: 83
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 334
|
||||
Last Changed Date: 2016-08-12 11:08:03 +0200
|
||||
Last Changed Rev: 1443
|
||||
Last Changed Date: 2017-07-10 11:03:27.000000002 +0200 ./Makefile
|
||||
|
@ -1,11 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/moenchDetectorServer"
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "8aceb5d4b0ca6bd95a11b53e7a799b463b92d51b"
|
||||
//#define SVNREV 0x334
|
||||
#define SVNREPUUID "9f1b82c18ab0893d65bfadeb646b8ea244614632"
|
||||
//#define SVNREV 0x1443
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "Dhanya_Maliakal"
|
||||
#define SVNREV 0x334
|
||||
#define SVNDATE 0x20160812
|
||||
#define SVNREV 0x1443
|
||||
#define SVNDATE 0x20170710
|
||||
//
|
||||
|
31
slsDetectorSoftware/moenchDetectorServer/updateGitVersion.sh
Executable file
31
slsDetectorSoftware/moenchDetectorServer/updateGitVersion.sh
Executable file
@ -0,0 +1,31 @@
|
||||
SERVER=moenchDetectorServer
|
||||
MAINDIR=slsDetectorsPackage
|
||||
SPECDIR=slsDetectorSoftware/$SERVER
|
||||
TMPFILE=gitInfoMoenchTmp.h
|
||||
INCLFILE=gitInfoMoench.h
|
||||
|
||||
|
||||
#evaluate the variables
|
||||
EVALFILE=../../evalVersionVariables.sh
|
||||
source $EVALFILE
|
||||
|
||||
|
||||
#get modified date
|
||||
#RDATE1='git log --pretty=format:"%ci" -1'
|
||||
RDATE1="find . -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | egrep -v 'gitInfo|.git|updateGitVersion|.o' | head -n 1"
|
||||
RDATE=`eval $RDATE1`
|
||||
NEWDATE=$(sed "s/-//g" <<< $RDATE | awk '{print $1;}')
|
||||
NEWDATE=${NEWDATE/#/0x}
|
||||
|
||||
|
||||
#get old date from INCLFILE
|
||||
OLDDATE=$(more $INCLFILE | grep '#define SVNDATE' | awk '{print $3}')
|
||||
|
||||
|
||||
#update INCLFILE if changes
|
||||
if [ "$OLDDATE" != "$NEWDATE" ]; then
|
||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
||||
cd ../../
|
||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
||||
cd $WD
|
||||
fi
|
@ -1168,7 +1168,7 @@ int multiSlsDetector::getThresholdEnergy(int pos) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings isettings) {
|
||||
int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings isettings, int tb) {
|
||||
|
||||
int posmin, posmax;
|
||||
int ret=-100;
|
||||
@ -1189,8 +1189,8 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new int(-1);
|
||||
Task* task = new Task(new func3_t<int,slsDetector,int,int,detectorSettings,int>(&slsDetector::setThresholdEnergy,
|
||||
detectors[idet],e_eV,-1,isettings,iret[idet]));
|
||||
Task* task = new Task(new func4_t<int,slsDetector,int,int,detectorSettings,int,int>(&slsDetector::setThresholdEnergy,
|
||||
detectors[idet],e_eV,-1,isettings,tb,iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
@ -1359,75 +1359,219 @@ int multiSlsDetector::getChanRegs(double* retval,bool fromDetector){
|
||||
|
||||
/* Communication to server */
|
||||
|
||||
int multiSlsDetector::prepareAcquisition(){
|
||||
|
||||
int i=0;
|
||||
int ret=OK;
|
||||
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return FAIL;
|
||||
}else{
|
||||
int* iret[posmax-posmin];
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||
iret[idet]= new int(OK);
|
||||
Task* task = new Task(new func0_t<int,slsDetector,int>(&slsDetector::prepareAcquisition,
|
||||
detectors[idet],iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//master
|
||||
int ret1=OK;
|
||||
i=thisMultiDetector->masterPosition;
|
||||
if (thisMultiDetector->masterPosition>=0) {
|
||||
if (detectors[i]) {
|
||||
ret1=detectors[i]->prepareAcquisition();
|
||||
if(detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<i));
|
||||
if (ret1!=OK)
|
||||
ret=FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::cleanupAcquisition(){
|
||||
int i=0;
|
||||
int ret=OK,ret1=OK;
|
||||
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||
|
||||
i=thisMultiDetector->masterPosition;
|
||||
if (thisMultiDetector->masterPosition>=0) {
|
||||
if (detectors[i]) {
|
||||
ret1=detectors[i]->cleanupAcquisition();
|
||||
if(detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<i));
|
||||
if (ret1!=OK)
|
||||
ret=FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return FAIL;
|
||||
}else{
|
||||
int* iret[posmax-posmin];
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||
iret[idet]= new int(OK);
|
||||
Task* task = new Task(new func0_t<int,slsDetector,int>(&slsDetector::cleanupAcquisition,
|
||||
detectors[idet],iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// Acquisition functions
|
||||
/* change these funcs accepting also ok/fail */
|
||||
|
||||
int multiSlsDetector::startAcquisition(){
|
||||
|
||||
int i=0;
|
||||
int ret=OK, ret1=OK;
|
||||
|
||||
for (i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||
if (i!=thisMultiDetector->masterPosition)
|
||||
if (detectors[i]) {
|
||||
ret=detectors[i]->startAcquisition();
|
||||
if(detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<i));
|
||||
if (ret!=OK)
|
||||
ret1=FAIL;
|
||||
}
|
||||
}
|
||||
i=thisMultiDetector->masterPosition;
|
||||
if (thisMultiDetector->masterPosition>=0) {
|
||||
if (detectors[i]) {
|
||||
ret=detectors[i]->startAcquisition();
|
||||
if(detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<i));
|
||||
if (ret!=OK)
|
||||
ret1=FAIL;
|
||||
}
|
||||
}
|
||||
return ret1;
|
||||
|
||||
if (getDetectorsType() == EIGER) {
|
||||
if (prepareAcquisition() == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
int i=0;
|
||||
int ret=OK;
|
||||
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return FAIL;
|
||||
}else{
|
||||
int* iret[posmax-posmin];
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||
iret[idet]= new int(OK);
|
||||
Task* task = new Task(new func0_t<int,slsDetector,int>(&slsDetector::startAcquisition,
|
||||
detectors[idet],iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//master
|
||||
int ret1=OK;
|
||||
i=thisMultiDetector->masterPosition;
|
||||
if (thisMultiDetector->masterPosition>=0) {
|
||||
if (detectors[i]) {
|
||||
ret1=detectors[i]->startAcquisition();
|
||||
if(detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<i));
|
||||
if (ret1!=OK)
|
||||
ret=FAIL;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::stopAcquisition(){
|
||||
int i=0;
|
||||
int ret=OK, ret1=OK;
|
||||
int i=0;
|
||||
int ret=OK,ret1=OK;
|
||||
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||
|
||||
i=thisMultiDetector->masterPosition;
|
||||
if (thisMultiDetector->masterPosition>=0) {
|
||||
if (detectors[i]) {
|
||||
ret1=detectors[i]->stopAcquisition();
|
||||
if(detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<i));
|
||||
if (ret1!=OK)
|
||||
ret=FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
i=thisMultiDetector->masterPosition;
|
||||
if (thisMultiDetector->masterPosition>=0) {
|
||||
if (detectors[i]) {
|
||||
ret=detectors[i]->stopAcquisition();
|
||||
if(detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<i));
|
||||
if (ret!=OK)
|
||||
ret1=FAIL;
|
||||
}
|
||||
}
|
||||
for (i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||
if (detectors[i]) {
|
||||
ret=detectors[i]->stopAcquisition();
|
||||
if(detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<i));
|
||||
if (ret!=OK)
|
||||
ret1=FAIL;
|
||||
}
|
||||
}
|
||||
*stoppedFlag=1;
|
||||
setAcquiringFlag(false);
|
||||
return ret1;
|
||||
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return FAIL;
|
||||
}else{
|
||||
int* iret[posmax-posmin];
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||
iret[idet]= new int(OK);
|
||||
Task* task = new Task(new func0_t<int,slsDetector,int>(&slsDetector::stopAcquisition,
|
||||
detectors[idet],iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if((idet!=thisMultiDetector->masterPosition) && (detectors[idet])){
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*stoppedFlag=1;
|
||||
setAcquiringFlag(false);
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::startReadOut(){
|
||||
|
||||
int i=0;
|
||||
@ -1633,8 +1777,12 @@ int* multiSlsDetector::startAndReadAll(){
|
||||
int* retval;
|
||||
int i=0;
|
||||
if (thisMultiDetector->onlineFlag==ONLINE_FLAG) {
|
||||
|
||||
startAndReadAllNoWait();
|
||||
|
||||
if(getDetectorsType() == EIGER) {
|
||||
if (prepareAcquisition() == FAIL)
|
||||
return NULL;
|
||||
}
|
||||
startAndReadAllNoWait();
|
||||
|
||||
while ((retval=getDataFromDetector())){
|
||||
i++;
|
||||
@ -2971,13 +3119,12 @@ int multiSlsDetector::getAngularConversion(int &direction, angleConversionCons
|
||||
|
||||
dacs_t multiSlsDetector::setDAC(dacs_t val, dacIndex idac, int mV, int imod) {
|
||||
dacs_t ret = -100;
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return -1;
|
||||
}else{
|
||||
|
||||
// single
|
||||
{
|
||||
int id=-1, im=-1;
|
||||
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
|
||||
posmin=id;
|
||||
posmax=id+1;
|
||||
}
|
||||
@ -3007,50 +3154,108 @@ dacs_t multiSlsDetector::setDAC(dacs_t val, dacIndex idac, int mV, int imod) {
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// multi
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||
dacs_t* iret[posmax-posmin];
|
||||
|
||||
for(int idet=posmin; idet<posmax; ++idet){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new dacs_t(-1);
|
||||
Task* task = new Task(new func4_t <dacs_t,slsDetector,dacs_t,dacIndex,int,int,dacs_t>(&slsDetector::setDAC,
|
||||
detectors[idet],val, idac, mV, imod, iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
|
||||
// highvoltage of slave, ignore value
|
||||
if ((idac == HV_NEW) && (*iret[idet] == -999))
|
||||
;
|
||||
else {
|
||||
if (ret==-100)
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
}
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
if (ret==-100)
|
||||
ret = -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
dacs_t multiSlsDetector::getADC(dacIndex idac, int imod) {
|
||||
dacs_t ret = -100;
|
||||
|
||||
// single
|
||||
{
|
||||
int id=-1, im=-1;
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if(detectors[id]){
|
||||
ret = detectors[id]->getADC(idac, im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// multi
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return -1;
|
||||
}else{
|
||||
int id=-1, im=-1;
|
||||
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
posmin=id;
|
||||
posmax=id+1;
|
||||
}
|
||||
//return storage values
|
||||
dacs_t* iret[posmax-posmin];
|
||||
for(int idet=posmin; idet<posmax; ++idet){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new dacs_t(-1);
|
||||
Task* task = new Task(new func2_t <dacs_t,slsDetector,dacIndex,int,dacs_t>(&slsDetector::getADC,
|
||||
detectors[idet],idac, im, iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
if (ret==-100)
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
|
||||
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||
dacs_t* iret[posmax-posmin];
|
||||
|
||||
for(int idet=posmin; idet<posmax; ++idet){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new dacs_t(-1);
|
||||
Task* task = new Task(new func2_t <dacs_t,slsDetector,dacIndex,int,dacs_t>(&slsDetector::getADC,
|
||||
detectors[idet],idac, imod, iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
if (ret==-100)
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3061,7 +3266,7 @@ int multiSlsDetector::setChannel(int64_t reg, int ichan, int ichip, int imod) {
|
||||
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
dmi=id;
|
||||
dma=dma+1;
|
||||
dma=id+1;
|
||||
}
|
||||
for (int idet=dmi; idet<dma; idet++) {
|
||||
if (detectors[idet]) {
|
||||
@ -3409,6 +3614,13 @@ string multiSlsDetector::getNetworkParameter(networkParameter p) {
|
||||
*/
|
||||
string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||
|
||||
// disable data streaming before changing zmq port (but only if they were on)
|
||||
/*int prev_streaming = 0;*/
|
||||
if (p == RECEIVER_STREAMING_PORT) {
|
||||
/*prev_streaming = getStreamingSocketsCreatedInClient();*/
|
||||
enableDataStreamingFromReceiver(0);
|
||||
}
|
||||
|
||||
if (s.find('+')==string::npos) {
|
||||
|
||||
if(!threadpool){
|
||||
@ -3418,6 +3630,8 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||
string* sret[thisMultiDetector->numberOfDetectors];
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
if (p == RECEIVER_STREAMING_PORT)
|
||||
s.append("multi\0");
|
||||
sret[idet]=new string("error");
|
||||
Task* task = new Task(new func2_t <string,slsDetector,networkParameter,string,string>(&slsDetector::setNetworkParameter,
|
||||
detectors[idet],p,s,sret[idet]));
|
||||
@ -3458,7 +3672,11 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//enable data streaming if it was on
|
||||
if (p == RECEIVER_STREAMING_PORT && prev_streaming)
|
||||
enableDataStreamingFromReceiver(1);
|
||||
*/
|
||||
return getNetworkParameter(p);
|
||||
|
||||
}
|
||||
@ -4044,51 +4262,55 @@ int multiSlsDetector::digitalTest(digitalTestMode mode, int imod) {
|
||||
|
||||
|
||||
int multiSlsDetector::executeTrimming(trimMode mode, int par1, int par2, int imod) {
|
||||
int id, im, ret=100;
|
||||
int ret=100;
|
||||
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if (detectors[id]) {
|
||||
ret = detectors[id]->executeTrimming(mode, par1, par2, im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
return ret;
|
||||
}
|
||||
} else if (imod<0) {
|
||||
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
// single
|
||||
{
|
||||
int id=-1, im=-1;
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if (detectors[id]) {
|
||||
ret = detectors[id]->executeTrimming(mode, par1, par2, im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
}else{
|
||||
//return storage values
|
||||
int* iret[thisMultiDetector->numberOfDetectors];
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new int(-1);
|
||||
Task* task = new Task(new func4_t <int,slsDetector,trimMode,int,int,int,int>(&slsDetector::executeTrimming,
|
||||
detectors[idet],mode,par1,par2,imod,iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
if (ret==-100)
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
// multi
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int* iret[thisMultiDetector->numberOfDetectors];
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new int(-1);
|
||||
Task* task = new Task(new func4_t <int,slsDetector,trimMode,int,int,int,int>(&slsDetector::executeTrimming,
|
||||
detectors[idet],mode,par1,par2,imod,iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
if (ret==-100)
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -4144,121 +4366,124 @@ int multiSlsDetector::powerChip(int ival){
|
||||
|
||||
|
||||
int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
||||
int id, im, ret=OK;
|
||||
int ret=OK;
|
||||
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if (detectors[id]) {
|
||||
ret = detectors[id]->loadSettingsFile(fname, im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
return ret;
|
||||
}
|
||||
} else if (imod<0) {
|
||||
// single
|
||||
{
|
||||
int id=-1, im=-1;
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if(detectors[id]){
|
||||
ret = detectors[id]->loadSettingsFile(fname, im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return -1;
|
||||
}else{
|
||||
//return storage values
|
||||
int* iret[thisMultiDetector->numberOfDetectors];
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new int(OK);
|
||||
Task* task = new Task(new func2_t <int,slsDetector,string,int,int>(&slsDetector::loadSettingsFile,
|
||||
detectors[idet],fname,imod,iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
}
|
||||
// multi
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
int* iret[thisMultiDetector->numberOfDetectors];
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new int(OK);
|
||||
Task* task = new Task(new func2_t <int,slsDetector,string,int,int>(&slsDetector::loadSettingsFile,
|
||||
detectors[idet],fname,imod,iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::saveSettingsFile(string fname, int imod) {
|
||||
int id, im, ret;
|
||||
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if (detectors[id]) {
|
||||
ret = detectors[id]->saveSettingsFile(fname, im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
return ret;
|
||||
}
|
||||
} else if (imod<0) {
|
||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
||||
if (detectors[idet]) {
|
||||
ret=detectors[idet]->saveSettingsFile(fname, imod);
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
int id=-1, im=-1, ret;
|
||||
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if (detectors[id]) {
|
||||
ret = detectors[id]->saveSettingsFile(fname, im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
||||
if (detectors[idet]) {
|
||||
ret=detectors[idet]->saveSettingsFile(fname, imod);
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::setAllTrimbits(int val, int imod){
|
||||
|
||||
int ret=-100,id, im;
|
||||
int ret=-100;
|
||||
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if (detectors[id]) {
|
||||
ret=detectors[id]->setAllTrimbits(val,im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
// single
|
||||
{
|
||||
int id=-1, im=-1;
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if(detectors[id]){
|
||||
ret = detectors[id]->setAllTrimbits(val,im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (imod<0) {
|
||||
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return -1;
|
||||
}else{
|
||||
//return storage values
|
||||
int* iret[thisMultiDetector->numberOfDetectors];
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new int(-1);
|
||||
Task* task = new Task(new func2_t <int,slsDetector,int,int,int>(&slsDetector::setAllTrimbits,
|
||||
detectors[idet],val,imod,iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
if (ret==-100)
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
// multi
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return -1;
|
||||
}
|
||||
int* iret[thisMultiDetector->numberOfDetectors];
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new int(-1);
|
||||
Task* task = new Task(new func2_t <int,slsDetector,int,int,int>(&slsDetector::setAllTrimbits,
|
||||
detectors[idet],val,imod,iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
if (ret==-100)
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -4269,73 +4494,75 @@ int multiSlsDetector::setAllTrimbits(int val, int imod){
|
||||
|
||||
|
||||
int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
||||
int id, im, ret = OK;
|
||||
int ret = OK;
|
||||
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if (detectors[id]) {
|
||||
ret = detectors[id]->loadCalibrationFile(fname, im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
return ret;
|
||||
}
|
||||
} else if (imod<0) {
|
||||
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
// single
|
||||
{
|
||||
int id=-1, im=-1;
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if(detectors[id]){
|
||||
ret = detectors[id]->loadCalibrationFile(fname, im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
}else{
|
||||
//return storage values
|
||||
int* iret[thisMultiDetector->numberOfDetectors];
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new int(OK);
|
||||
Task* task = new Task(new func2_t <int,slsDetector,string,int,int>(&slsDetector::loadCalibrationFile,
|
||||
detectors[idet],fname,imod,iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
|
||||
// multi
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int* iret[thisMultiDetector->numberOfDetectors];
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new int(OK);
|
||||
Task* task = new Task(new func2_t <int,slsDetector,string,int,int>(&slsDetector::loadCalibrationFile,
|
||||
detectors[idet],fname,imod,iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::saveCalibrationFile(string fname, int imod) {
|
||||
int id, im, ret;
|
||||
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if (detectors[id]) {
|
||||
ret = detectors[id]->saveCalibrationFile(fname, im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
return ret;
|
||||
}
|
||||
} else if (imod<0) {
|
||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
||||
if (detectors[idet]) {
|
||||
ret=detectors[idet]->saveCalibrationFile(fname, imod);
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
int id=-1, im=-1, ret;
|
||||
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if (detectors[id]) {
|
||||
ret = detectors[id]->saveCalibrationFile(fname, im);
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
||||
if (detectors[idet]) {
|
||||
ret=detectors[idet]->saveCalibrationFile(fname, imod);
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -5213,8 +5440,15 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy){
|
||||
cprintf(MAGENTA,"Going to create data sockets\n");
|
||||
|
||||
for(int i=0;i<numSockets; ++i){
|
||||
uint32_t portnum = DEFAULT_ZMQ_PORTNO +
|
||||
(i/numSocketsPerDetector)*numSocketsPerDetector + (i%numSocketsPerDetector);
|
||||
uint32_t portnum;
|
||||
sscanf(detectors[i/numSocketsPerDetector]->getReceiverStreamingPort().c_str(),"%d",&portnum);
|
||||
if (portnum == 0) {
|
||||
portnum = DEFAULT_ZMQ_PORTNO +
|
||||
(i/numSocketsPerDetector)*numSocketsPerDetector + (i%numSocketsPerDetector); // *num and /num is not same cuz its integers
|
||||
}else{
|
||||
portnum += (i%numSocketsPerDetector);
|
||||
}
|
||||
|
||||
zmqSocket[i] = new ZmqSocket(detectors[i/numSocketsPerDetector]->getReceiver().c_str(), portnum);
|
||||
if (zmqSocket[i]->IsError()) {
|
||||
cprintf(RED, "Error: Could not create Zmq socket on port %d\n", portnum);
|
||||
@ -5669,12 +5903,14 @@ int multiSlsDetector::setReceiverReadTimer(int time_in_ms){
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::getStreamingSocketsCreatedInClient() {
|
||||
return dataSocketsStarted;
|
||||
}
|
||||
|
||||
// only called from gui or that wants zmq data packets
|
||||
int multiSlsDetector::enableDataStreamingFromReceiver(int enable){
|
||||
|
||||
if(enable >= 0){
|
||||
if(dataSocketsStarted != enable){
|
||||
/*if(dataSocketsStarted != enable){*/
|
||||
//destroy data threads
|
||||
if(dataSocketsStarted)
|
||||
createReceivingDataSockets(true);
|
||||
@ -5689,7 +5925,7 @@ int multiSlsDetector::enableDataStreamingFromReceiver(int enable){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*}*/
|
||||
|
||||
}
|
||||
|
||||
@ -6035,6 +6271,11 @@ int multiSlsDetector::pulseChip(int n) {
|
||||
|
||||
void multiSlsDetector::setAcquiringFlag(bool b){
|
||||
thisMultiDetector->acquiringFlag = b;
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++){
|
||||
if(detectors[idet]){
|
||||
detectors[idet]->setAcquiringFlag(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool multiSlsDetector::getAcquiringFlag(){
|
||||
|
@ -462,9 +462,10 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
\param e_eV threshold in eV
|
||||
\param imod module number (-1 all)
|
||||
\param isettings ev. change settings
|
||||
\param tb 1 to include trimbits, 0 to exclude
|
||||
\returns current threshold value for imod in ev (-1 failed)
|
||||
*/
|
||||
int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS);
|
||||
int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS,int tb=1);
|
||||
|
||||
/**
|
||||
get detector settings
|
||||
@ -521,10 +522,10 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
int powerChip(int ival= -1);
|
||||
|
||||
/** loads the modules settings/trimbits reading from a file - file name extension is automatically generated! */
|
||||
int loadSettingsFile(string fname, int nmod=0);
|
||||
int loadSettingsFile(string fname, int nmod=-1);
|
||||
|
||||
/** gets the modules settings/trimbits and writes them to file - file name extension is automatically generated! */
|
||||
int saveSettingsFile(string fname, int nmod=0);
|
||||
int saveSettingsFile(string fname, int nmod=-1);
|
||||
|
||||
|
||||
/** sets all the trimbits to a particular value
|
||||
@ -536,10 +537,10 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
|
||||
|
||||
/** loads the modules calibration data reading from a file - file name extension is automatically generated! */
|
||||
int loadCalibrationFile(string fname, int nmod=0);
|
||||
int loadCalibrationFile(string fname, int nmod=-1);
|
||||
|
||||
/** gets the modules calibration data and writes them to file - file name extension is automatically generated! */
|
||||
int saveCalibrationFile(string fname, int nmod=0);
|
||||
int saveCalibrationFile(string fname, int nmod=-1);
|
||||
|
||||
|
||||
|
||||
@ -560,7 +561,17 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
|
||||
|
||||
// Acquisition functions
|
||||
/**
|
||||
prepares detector for acquisition
|
||||
\returns OK if all detectors are properly started, FAIL otherwise
|
||||
*/
|
||||
int prepareAcquisition();
|
||||
|
||||
/**
|
||||
prepares detector for acquisition
|
||||
\returns OK if all detectors are properly started, FAIL otherwise
|
||||
*/
|
||||
int cleanupAcquisition();
|
||||
|
||||
/**
|
||||
start detector acquisition (master is started as last)
|
||||
@ -928,7 +939,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
\param val value (in V)
|
||||
\param index DAC index
|
||||
\param imod module number (if -1 alla modules)
|
||||
\returns current DAC value
|
||||
\returns current DAC value (temperature for eiger and jungfrau in millidegrees)
|
||||
*/
|
||||
dacs_t getADC(dacIndex index, int imod=-1);
|
||||
/**
|
||||
@ -1318,6 +1329,13 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
*/
|
||||
int setReceiverReadTimer(int time_in_ms=500);
|
||||
|
||||
|
||||
/**
|
||||
* Get Streaming sockets created in client from reciever
|
||||
/returns 1 if sockets created, else 0
|
||||
*/
|
||||
int getStreamingSocketsCreatedInClient();
|
||||
|
||||
/** Enable or disable streaming data from receiver to client
|
||||
* @param enable 0 to disable 1 to enable -1 to only get the value
|
||||
* @returns data streaming
|
||||
|
@ -21,11 +21,15 @@ CFLAGS+= -Wall -DC_ONLY -DMCB_FUNCS -DDACS_INT $(VFLAGS)
|
||||
|
||||
LDLIBS+= -lm
|
||||
|
||||
mythen: clean $(PROGS)
|
||||
all: $(PROGS)
|
||||
mythen: clean versioning $(PROGS)
|
||||
all: versioning $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
versioning:
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
||||
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
echo $(OBJS)
|
||||
$(CC) $(LDFLAGS) $^ $(LDLIBS) $(CFLAGS) -o $@
|
||||
@ -39,3 +43,4 @@ clean:
|
||||
|
||||
depend:
|
||||
makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null
|
||||
|
@ -18,7 +18,7 @@ CFLAGS+= -Wall -DC_ONLY -DVERBOSE
|
||||
|
||||
LDLIBS+= -lm
|
||||
|
||||
all: $(PROGS)
|
||||
all: versioning $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
@ -35,3 +35,6 @@ clean:
|
||||
|
||||
depend:
|
||||
makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null
|
||||
|
||||
versioning:
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
@ -21,8 +21,8 @@ CFLAGS+= -Wall -DC_ONLY -DMCB_FUNCS -DVERBOSE -DVERYVERBOSE -DPICASSOD
|
||||
LDLIBS+= -lm
|
||||
|
||||
picasso: $(PICASSO)
|
||||
mythen: $(PROGS)
|
||||
all: $(PROGS) $(PICASSO)
|
||||
mythen: versioning $(PROGS)
|
||||
all: versioning $(PROGS) $(PICASSO)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
@ -44,3 +44,6 @@ clean:
|
||||
|
||||
depend:
|
||||
makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null
|
||||
|
||||
versioning:
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
31
slsDetectorSoftware/mythenDetectorServer/updateGitVersion.sh
Executable file
31
slsDetectorSoftware/mythenDetectorServer/updateGitVersion.sh
Executable file
@ -0,0 +1,31 @@
|
||||
SERVER=mythenDetectorServer
|
||||
MAINDIR=slsDetectorsPackage
|
||||
SPECDIR=slsDetectorSoftware/$SERVER
|
||||
TMPFILE=gitInfoMythenTmp.h
|
||||
INCLFILE=gitInfoMythen.h
|
||||
|
||||
|
||||
#evaluate the variables
|
||||
EVALFILE=../../evalVersionVariables.sh
|
||||
source $EVALFILE
|
||||
|
||||
|
||||
#get modified date
|
||||
#RDATE1='git log --pretty=format:"%ci" -1'
|
||||
RDATE1="find ../slsDetectorServer . -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | egrep -v 'gitInfo|bin|.git|updateGitVersion|.o' | head -n 1"
|
||||
RDATE=`eval $RDATE1`
|
||||
NEWDATE=$(sed "s/-//g" <<< $RDATE | awk '{print $1;}')
|
||||
NEWDATE=${NEWDATE/#/0x}
|
||||
|
||||
|
||||
#get old date from INCLFILE
|
||||
OLDDATE=$(more $INCLFILE | grep '#define SVNDATE' | awk '{print $3}')
|
||||
|
||||
|
||||
#update INCLFILE if changes
|
||||
if [ "$OLDDATE" != "$NEWDATE" ]; then
|
||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
||||
cd ../../
|
||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
||||
cd $WD
|
||||
fi
|
@ -1,11 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUIDLIB "a5b59b47430913bb461b50da05b553874b33f39a"
|
||||
//#define SVNREV 0x1418
|
||||
#define SVNREPUUIDLIB "2dfbd9016b501eca6ee2c00a08e49a3f7e7990d8"
|
||||
//#define SVNREV 0x1457
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTHLIB "Dhanya_Maliakal"
|
||||
#define SVNREVLIB 0x1418
|
||||
#define SVNDATELIB 0x20170622
|
||||
#define SVNREVLIB 0x1457
|
||||
#define SVNDATELIB 0x20170809
|
||||
//
|
||||
|
@ -26,9 +26,9 @@ int slsDetector::initSharedMemory(detectorType type, int id) {
|
||||
#ifdef VERBOSE
|
||||
cout << "init shm"<< endl;
|
||||
#endif
|
||||
switch(type) {
|
||||
switch(type) {
|
||||
case MYTHEN:
|
||||
nch=128; // complete mythen system
|
||||
nch=128; // complete mythen system
|
||||
nm=24;
|
||||
nc=10;
|
||||
nd=6; // dacs+adcs
|
||||
@ -777,6 +777,7 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
||||
thisDetector->acquiringFlag = false;
|
||||
thisDetector->flippedData[0] = 0;
|
||||
thisDetector->flippedData[1] = 0;
|
||||
thisDetector->zmqport = 0;
|
||||
|
||||
for (int ia=0; ia<MAX_ACTIONS; ia++) {
|
||||
strcpy(thisDetector->actionScript[ia],"none");
|
||||
@ -1674,7 +1675,7 @@ int slsDetector::setDetectorType(detectorType const type){
|
||||
|
||||
|
||||
//receiver
|
||||
if((retType != GENERIC) && (thisDetector->receiverOnlineFlag==ONLINE_FLAG)) {
|
||||
if((retType != GENERIC) && (thisDetector->receiverOnlineFlag==ONLINE_FLAG) && (arg != GENERIC)) {
|
||||
retval = FAIL;
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
@ -2981,7 +2982,7 @@ int slsDetector::setModule(int reg, int imod){
|
||||
|
||||
};
|
||||
|
||||
int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int e_eV, int* gainval, int* offsetval){
|
||||
int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int e_eV, int* gainval, int* offsetval, int tb){
|
||||
|
||||
int fnum=F_SET_MODULE;
|
||||
int retval;
|
||||
@ -2998,6 +2999,11 @@ int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
//to exclude trimbits
|
||||
if(!tb) {
|
||||
module.nchan=0;
|
||||
module.nchip=0;
|
||||
}
|
||||
sendModule(&module);
|
||||
|
||||
//not included in module
|
||||
@ -3031,23 +3037,29 @@ int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int
|
||||
if (ret!=FAIL) {
|
||||
if (detectorModules) {
|
||||
if (imod>=0 && imod<thisDetector->nMod[X]*thisDetector->nMod[Y]) {
|
||||
(detectorModules+imod)->nchan=module.nchan;
|
||||
(detectorModules+imod)->nchip=module.nchip;
|
||||
if(tb) {
|
||||
(detectorModules+imod)->nchan=module.nchan;
|
||||
(detectorModules+imod)->nchip=module.nchip;
|
||||
}
|
||||
(detectorModules+imod)->ndac=module.ndac;
|
||||
(detectorModules+imod)->nadc=module.nadc;
|
||||
thisDetector->nChips=module.nchip;
|
||||
thisDetector->nChans=module.nchan/module.nchip;
|
||||
if(tb) {
|
||||
thisDetector->nChips=module.nchip;
|
||||
thisDetector->nChans=module.nchan/module.nchip;
|
||||
}
|
||||
thisDetector->nDacs=module.ndac;
|
||||
thisDetector->nAdcs=module.nadc;
|
||||
|
||||
if(thisDetector->myDetectorType != JUNGFRAU){
|
||||
for (int ichip=0; ichip<thisDetector->nChips; ichip++) {
|
||||
if (chipregs)
|
||||
chipregs[ichip+thisDetector->nChips*imod]=module.chipregs[ichip];
|
||||
if(tb) {
|
||||
for (int ichip=0; ichip<thisDetector->nChips; ichip++) {
|
||||
if (chipregs)
|
||||
chipregs[ichip+thisDetector->nChips*imod]=module.chipregs[ichip];
|
||||
|
||||
if (chanregs) {
|
||||
for (int i=0; i<thisDetector->nChans; i++) {
|
||||
chanregs[i+ichip*thisDetector->nChans+thisDetector->nChips*thisDetector->nChans*imod]=module.chanregs[ichip*thisDetector->nChans+i];
|
||||
if (chanregs) {
|
||||
for (int i=0; i<thisDetector->nChans; i++) {
|
||||
chanregs[i+ichip*thisDetector->nChans+thisDetector->nChips*thisDetector->nChans*imod]=module.chanregs[ichip*thisDetector->nChans+i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3278,11 +3290,11 @@ int slsDetector::getThresholdEnergy(int imod){
|
||||
return thisDetector->currentThresholdEV;
|
||||
};
|
||||
|
||||
int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isettings){
|
||||
int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isettings, int tb){
|
||||
|
||||
//currently only for eiger
|
||||
if (thisDetector->myDetectorType == EIGER) {
|
||||
setThresholdEnergyAndSettings(e_eV,isettings);
|
||||
setThresholdEnergyAndSettings(e_eV,isettings,tb);
|
||||
return thisDetector->currentThresholdEV;
|
||||
}
|
||||
|
||||
@ -3323,7 +3335,7 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
|
||||
|
||||
|
||||
|
||||
int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings) {
|
||||
int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings, int tb) {
|
||||
|
||||
//if settings provided, use that, else use the shared memory variable
|
||||
detectorSettings is = ((isettings != GET_SETTINGS) ? isettings: thisDetector->currentSettings);
|
||||
@ -3389,7 +3401,7 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
||||
#endif
|
||||
//read the files
|
||||
myMod=createModule();
|
||||
if (NULL == readSettingsFile(settingsfname,thisDetector->myDetectorType, iodelay, tau, myMod)) {
|
||||
if (NULL == readSettingsFile(settingsfname,thisDetector->myDetectorType, iodelay, tau, myMod, tb)) {
|
||||
if(myMod)deleteModule(myMod);
|
||||
return FAIL;
|
||||
}
|
||||
@ -3424,13 +3436,13 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
||||
int tau1 = -1; //not included in the module
|
||||
int iodelay2 = -1; //not included in the module
|
||||
int tau2 = -1; //not included in the module
|
||||
if (NULL == readSettingsFile(settingsfname1,thisDetector->myDetectorType, iodelay1, tau1, myMod1)) {
|
||||
if (NULL == readSettingsFile(settingsfname1,thisDetector->myDetectorType, iodelay1, tau1, myMod1, tb)) {
|
||||
setErrorMask((getErrorMask())|(SETTINGS_FILE_NOT_OPEN));
|
||||
deleteModule(myMod1);
|
||||
deleteModule(myMod2);
|
||||
return FAIL;
|
||||
}
|
||||
if (NULL == readSettingsFile(settingsfname2,thisDetector->myDetectorType, iodelay2, tau2, myMod2)) {
|
||||
if (NULL == readSettingsFile(settingsfname2,thisDetector->myDetectorType, iodelay2, tau2, myMod2, tb)) {
|
||||
setErrorMask((getErrorMask())|(SETTINGS_FILE_NOT_OPEN));
|
||||
deleteModule(myMod1);
|
||||
deleteModule(myMod2);
|
||||
@ -3446,14 +3458,14 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
||||
iodelay = iodelay1;
|
||||
|
||||
//interpolate module
|
||||
myMod = interpolateTrim(thisDetector->myDetectorType, myMod1, myMod2, e_eV, trim1, trim2);
|
||||
myMod = interpolateTrim(thisDetector->myDetectorType, myMod1, myMod2, e_eV, trim1, trim2, tb);
|
||||
if (myMod == NULL) {
|
||||
printf("Could not interpolate, different dac values in files\n");
|
||||
setErrorMask((getErrorMask())|(SETTINGS_NOT_SET));
|
||||
}
|
||||
//interpolate tau
|
||||
tau = linearInterpolation(e_eV, trim1, trim2, tau1, tau2);
|
||||
printf("new tau:%d\n",tau);
|
||||
//printf("new tau:%d\n",tau);
|
||||
|
||||
deleteModule(myMod1);
|
||||
deleteModule(myMod2);
|
||||
@ -3462,7 +3474,7 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
||||
|
||||
myMod->module=0;
|
||||
myMod->reg=thisDetector->currentSettings;
|
||||
setModule(*myMod, iodelay, tau, e_eV, 0, 0);
|
||||
setModule(*myMod, iodelay, tau, e_eV, 0, 0, tb);
|
||||
deleteModule(myMod);
|
||||
if (getSettings(-1) != is){
|
||||
std::cout << "Could not set settings in detector" << endl;
|
||||
@ -3965,6 +3977,62 @@ int slsDetector::updateDetector() {
|
||||
// Acquisition functions
|
||||
/* change these funcs accepting also ok/fail */
|
||||
|
||||
|
||||
int slsDetector::prepareAcquisition() {
|
||||
int fnum = F_PREPARE_ACQUISITION;
|
||||
int ret=FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Preparing Detector for Acquisition" << std::endl;
|
||||
#endif
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL){
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
setErrorMask((getErrorMask())|(PREPARE_ACQUISITION));
|
||||
}
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}else
|
||||
std::cout << "cannot connect to detector" << endl;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int slsDetector::cleanupAcquisition() {
|
||||
int fnum = F_CLEANUP_ACQUISITION;
|
||||
int ret=FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Cleaning up Detector after Acquisition " << std::endl;
|
||||
#endif
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL){
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
setErrorMask((getErrorMask())|(CLEANUP_ACQUISITION));
|
||||
}
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}else
|
||||
std::cout << "cannot connect to detector" << endl;
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int slsDetector::startAcquisition(){
|
||||
|
||||
|
||||
@ -4247,6 +4315,10 @@ int* slsDetector::startAndReadAll(){
|
||||
int i=0;
|
||||
#endif
|
||||
//#endif
|
||||
if(thisDetector->myDetectorType == EIGER) {
|
||||
if (prepareAcquisition() == FAIL)
|
||||
return NULL;
|
||||
}
|
||||
startAndReadAllNoWait();
|
||||
//#ifdef VERBOSE
|
||||
// std::cout<< "started" << std::endl;
|
||||
@ -4439,7 +4511,8 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
||||
|
||||
|
||||
//send acquisiton period/frame number to receiver
|
||||
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)||(index==ACQUISITION_TIME)){
|
||||
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)||(index==ACQUISITION_TIME) || (index==SUBFRAME_ACQUISITION_TIME)){
|
||||
string timername = getTimerType(index);
|
||||
if(ret != FAIL){
|
||||
int64_t args[2];
|
||||
retval = -1;
|
||||
@ -4448,25 +4521,21 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
||||
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
|
||||
//set #frames, #cycles
|
||||
//set #frames * #cycles
|
||||
if((index==FRAME_NUMBER)||(index==CYCLES_NUMBER)){
|
||||
timername.assign("(Number of Frames) * (Number of cycles)");
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Setting/Getting number of frames*cycles " << index <<" to/from receiver " << args[1] << std::endl;
|
||||
std::cout << "Setting/Getting " << timername << " " << index <<" to/from receiver " << args[1] << std::endl;
|
||||
#endif
|
||||
if(thisDetector->timerValue[CYCLES_NUMBER]==0)
|
||||
args[1] = thisDetector->timerValue[FRAME_NUMBER];
|
||||
else
|
||||
args[1] = thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER];
|
||||
}
|
||||
//set period/exptime
|
||||
else{
|
||||
#ifdef VERBOSE
|
||||
if(index==ACQUISITION_TIME)
|
||||
std::cout << "Setting/Getting acquisition time " << index << " to/from receiver " << args[1] << std::endl;
|
||||
else
|
||||
std::cout << "Setting/Getting acquisition period " << index << " to/from receiver " << args[1] << std::endl;
|
||||
// set period/exptime/subexptime
|
||||
else std::cout << "Setting/Getting " << timername << " " << index << " to/from receiver " << args[1] << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
if (connectData() == OK){
|
||||
@ -4475,18 +4544,23 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
||||
}
|
||||
if((args[1] != retval)|| (ret==FAIL)){
|
||||
ret = FAIL;
|
||||
if(index==ACQUISITION_TIME){
|
||||
if(strstr(mess,"receiver not idle")==NULL)
|
||||
cout << "ERROR:Acquisition Time in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACQ_TIME_NOT_SET));
|
||||
}else if(index==FRAME_PERIOD){
|
||||
if(strstr(mess,"receiver not idle")==NULL)
|
||||
cout << "ERROR:Acquisition Period in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
|
||||
}else{
|
||||
if(strstr(mess,"receiver not idle")==NULL)
|
||||
cout << "ERROR:Number of Frames (* Number of cycles) in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
|
||||
setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET));
|
||||
cout << "ERROR: " << timername << " in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
|
||||
|
||||
if(strstr(mess,"receiver is not idle")==NULL) {
|
||||
switch(index) {
|
||||
case ACQUISITION_TIME:
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACQ_TIME_NOT_SET));
|
||||
break;
|
||||
case FRAME_PERIOD:
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
|
||||
break;
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
setErrorMask((getErrorMask())|(RECEIVER_SUBF_TIME_NOT_SET));
|
||||
break;
|
||||
default:
|
||||
setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ret==FORCE_UPDATE)
|
||||
@ -5827,7 +5901,6 @@ int slsDetector::exitServer(){
|
||||
|
||||
string slsDetector::setNetworkParameter(networkParameter index, string value) {
|
||||
int i;
|
||||
|
||||
switch (index) {
|
||||
case DETECTOR_MAC:
|
||||
return setDetectorMAC(value);
|
||||
@ -5845,19 +5918,22 @@ string slsDetector::setNetworkParameter(networkParameter index, string value) {
|
||||
return getReceiverUDPPort();
|
||||
case RECEIVER_UDP_PORT2:
|
||||
sscanf(value.c_str(),"%d",&i);
|
||||
if(thisDetector->myDetectorType == EIGER)
|
||||
if(thisDetector->myDetectorType == EIGER) {
|
||||
setReceiverUDPPort2(i);
|
||||
else
|
||||
setReceiverUDPPort(i);
|
||||
if(thisDetector->myDetectorType == EIGER)
|
||||
return getReceiverUDPPort2();
|
||||
return getReceiverUDPPort();
|
||||
} else {
|
||||
setReceiverUDPPort(i);
|
||||
return getReceiverUDPPort();
|
||||
}
|
||||
case DETECTOR_TXN_DELAY_LEFT:
|
||||
case DETECTOR_TXN_DELAY_RIGHT:
|
||||
case DETECTOR_TXN_DELAY_FRAME:
|
||||
case FLOW_CONTROL_10G:
|
||||
sscanf(value.c_str(),"%d",&i);
|
||||
return setDetectorNetworkParameter(index, i);
|
||||
case RECEIVER_STREAMING_PORT:
|
||||
setReceiverStreamingPort(value);
|
||||
return getReceiverStreamingPort();
|
||||
default:
|
||||
return (char*)("unknown network parameter");
|
||||
}
|
||||
@ -5867,34 +5943,29 @@ string slsDetector::setNetworkParameter(networkParameter index, string value) {
|
||||
|
||||
|
||||
string slsDetector::getNetworkParameter(networkParameter index) {
|
||||
|
||||
ostringstream ss;string s;
|
||||
switch (index) {
|
||||
case DETECTOR_MAC:
|
||||
return getDetectorMAC();
|
||||
break;
|
||||
case DETECTOR_IP:
|
||||
return getDetectorIP();
|
||||
break;
|
||||
case RECEIVER_HOSTNAME:
|
||||
return getReceiver();
|
||||
break;
|
||||
case RECEIVER_UDP_IP:
|
||||
return getReceiverUDPIP();
|
||||
break;
|
||||
case RECEIVER_UDP_MAC:
|
||||
return getReceiverUDPMAC();
|
||||
break;
|
||||
case RECEIVER_UDP_PORT:
|
||||
return getReceiverUDPPort();
|
||||
break;
|
||||
case RECEIVER_UDP_PORT2:
|
||||
return getReceiverUDPPort2();
|
||||
break;
|
||||
case DETECTOR_TXN_DELAY_LEFT:
|
||||
case DETECTOR_TXN_DELAY_RIGHT:
|
||||
case DETECTOR_TXN_DELAY_FRAME:
|
||||
case FLOW_CONTROL_10G:
|
||||
return setDetectorNetworkParameter(index, -1);
|
||||
case RECEIVER_STREAMING_PORT:
|
||||
return getReceiverStreamingPort();
|
||||
default:
|
||||
return (char*)("unknown network parameter");
|
||||
}
|
||||
@ -5974,6 +6045,7 @@ string slsDetector::setReceiver(string receiverIP){
|
||||
std::cout << "file path:" << fileIO::getFilePath() << endl;
|
||||
std::cout << "file name:" << fileIO::getFileName() << endl;
|
||||
std::cout << "file index:" << fileIO::getFileIndex() << endl;
|
||||
std::cout << "file format:" << fileIO::getFileFormat() << endl;
|
||||
pthread_mutex_lock(&ms);
|
||||
std::cout << "write enable:" << parentDet->enableWriteToFileMask() << endl;
|
||||
std::cout << "overwrite enable:" << parentDet->enableOverwriteMask() << endl;
|
||||
@ -5981,8 +6053,12 @@ string slsDetector::setReceiver(string receiverIP){
|
||||
std::cout << "frame index needed:" << ((thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER])>1) << endl;
|
||||
std::cout << "frame period:" << thisDetector->timerValue[FRAME_PERIOD] << endl;
|
||||
std::cout << "frame number:" << thisDetector->timerValue[FRAME_NUMBER] << endl;
|
||||
std::cout << "sub exp time:" << thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME] << endl;
|
||||
std::cout << "dynamic range:" << thisDetector->dynamicRange << endl << endl;
|
||||
std::cout << "flippeddatax:" << thisDetector->flippedData[d] << endl;
|
||||
std::cout << "10GbE:" << thisDetector->tenGigaEnable << endl << endl;
|
||||
std::cout << "streaming port:" << thisDetector->zmqport << endl;
|
||||
|
||||
//std::cout << "dataStreaming:" << enableDataStreamingFromReceiver(-1) << endl << endl;
|
||||
/** enable compresison, */
|
||||
#endif
|
||||
@ -5991,6 +6067,8 @@ string slsDetector::setReceiver(string receiverIP){
|
||||
sendMultiDetectorSize();
|
||||
setDetectorId();
|
||||
setDetectorHostname();
|
||||
setUDPConnection();
|
||||
|
||||
setFilePath(fileIO::getFilePath());
|
||||
setFileName(fileIO::getFileName());
|
||||
setFileIndex(fileIO::getFileIndex());
|
||||
@ -6003,6 +6081,7 @@ string slsDetector::setReceiver(string receiverIP){
|
||||
imask = parentDet->enableOverwriteMask();
|
||||
pthread_mutex_unlock(&ms);
|
||||
overwriteFile(imask);
|
||||
|
||||
if ((thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER])>1)
|
||||
setFrameIndex(0);
|
||||
else
|
||||
@ -6011,19 +6090,30 @@ string slsDetector::setReceiver(string receiverIP){
|
||||
setTimer(FRAME_PERIOD,thisDetector->timerValue[FRAME_PERIOD]);
|
||||
setTimer(FRAME_NUMBER,thisDetector->timerValue[FRAME_NUMBER]);
|
||||
setTimer(ACQUISITION_TIME,thisDetector->timerValue[ACQUISITION_TIME]);
|
||||
setTimer(SUBFRAME_ACQUISITION_TIME,thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]);
|
||||
setDynamicRange(thisDetector->dynamicRange);
|
||||
if(thisDetector->myDetectorType == EIGER){
|
||||
setFlippedData(X,-1);
|
||||
activate(-1);
|
||||
}
|
||||
//std::cout << "***********************************dataStreaming:" << parentDet->enableDataStreamingFromReceiver(-1) << endl << endl;
|
||||
//parentDet->enableDataStreamingFromReceiver(parentDet->enableDataStreamingFromReceiver(-1));
|
||||
//set scan tag
|
||||
setUDPConnection();
|
||||
|
||||
if(thisDetector->myDetectorType == EIGER)
|
||||
enableTenGigabitEthernet(thisDetector->tenGigaEnable);
|
||||
//datastreamenable
|
||||
//fifodepth
|
||||
|
||||
// data streaming
|
||||
setReceiverStreamingPort(getReceiverStreamingPort());
|
||||
int clientSockets = parentDet->getStreamingSocketsCreatedInClient();
|
||||
int recSockets = enableDataStreamingFromReceiver(-1);
|
||||
if(clientSockets != recSockets) {
|
||||
pthread_mutex_lock(&ms);
|
||||
if(clientSockets)
|
||||
printf("Enabling Data Streaming\n");
|
||||
else
|
||||
printf("Disabling Data Streaming\n");
|
||||
// push client state to receiver
|
||||
parentDet->enableDataStreamingFromReceiver(clientSockets);
|
||||
pthread_mutex_unlock(&ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6122,6 +6212,42 @@ int slsDetector::setReceiverUDPPort2(int udpport){
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::setReceiverStreamingPort(string port) {
|
||||
int defaultport = 0;
|
||||
int numsockets = (thisDetector->myDetectorType == EIGER) ? 2:1;
|
||||
int arg = 0;
|
||||
|
||||
//multi command, calculate individual ports
|
||||
size_t found = port.find("multi");
|
||||
if(found != string::npos) {
|
||||
port.erase(found,5);
|
||||
sscanf(port.c_str(),"%d",&defaultport);
|
||||
arg = defaultport + (posId * numsockets);
|
||||
}
|
||||
else
|
||||
sscanf(port.c_str(),"%d",&arg);
|
||||
|
||||
// send to receiver
|
||||
int fnum=F_SET_RECEIVER_STREAMING_PORT;
|
||||
int ret = FAIL;
|
||||
int retval=-1;
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending receiver streaming port to receiver " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendInt(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret!=FAIL)
|
||||
thisDetector->zmqport = retval;
|
||||
if(ret==FORCE_UPDATE)
|
||||
updateReceiver();
|
||||
}
|
||||
|
||||
return thisDetector->zmqport;
|
||||
}
|
||||
|
||||
string slsDetector::setDetectorNetworkParameter(networkParameter index, int delay){
|
||||
int fnum = F_SET_NETWORK_PARAMETER;
|
||||
int ret = FAIL;
|
||||
@ -7794,6 +7920,7 @@ int slsDetector::startReceiver(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//let detector prepare anyway even if receiver didnt work (for those not using the receiver)
|
||||
if((thisDetector->myDetectorType != JUNGFRAU) ) {
|
||||
int ret1 = detectorSendToReceiver(true);
|
||||
@ -7813,7 +7940,7 @@ int slsDetector::stopReceiver(){
|
||||
char mess[MAX_STR_LENGTH] = "";
|
||||
|
||||
if(thisDetector->myDetectorType != EIGER && thisDetector->myDetectorType != JUNGFRAU)
|
||||
detectorSendToReceiver(false);
|
||||
cleanupAcquisition(); // reset (send data to receiver) for these detectors, so back to CPU (dont care about ok/fail at this point)
|
||||
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
@ -7859,37 +7986,6 @@ slsDetectorDefs::runStatus slsDetector::startReceiverReadout(){
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::detectorSendToReceiver(bool set){
|
||||
int fnum;
|
||||
if(set) fnum=F_PREPARE_ACQUISITION;
|
||||
else fnum=F_CLEANUP_ACQUISITION;
|
||||
int ret = FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Setting detector to send packets via client to: " << set << std::endl;
|
||||
#endif
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL){
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
}
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}else
|
||||
std::cout << "cannot connect to detector" << endl;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -8098,21 +8194,46 @@ int slsDetector::updateReceiverNoWait() {
|
||||
cout << "Updating receiver last modified by " << lastClientIP << std::endl;
|
||||
#endif
|
||||
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
pthread_mutex_lock(&ms);
|
||||
fileIO::setFileIndex(ind);
|
||||
pthread_mutex_unlock(&ms);
|
||||
|
||||
// filepath
|
||||
n += dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH);
|
||||
pthread_mutex_lock(&ms);
|
||||
fileIO::setFilePath(path);
|
||||
pthread_mutex_unlock(&ms);
|
||||
|
||||
// filename
|
||||
n += dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH);
|
||||
pthread_mutex_lock(&ms);
|
||||
fileIO::setFileName(path);
|
||||
pthread_mutex_unlock(&ms);
|
||||
|
||||
// index
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
pthread_mutex_lock(&ms);
|
||||
fileIO::setFileIndex(ind);
|
||||
pthread_mutex_unlock(&ms);
|
||||
|
||||
//file format
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
pthread_mutex_lock(&ms);
|
||||
fileIO::setFileFormat(ind);
|
||||
pthread_mutex_unlock(&ms);
|
||||
|
||||
// file write enable
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
pthread_mutex_lock(&ms);
|
||||
parentDet->enableWriteToFileMask(ind);
|
||||
pthread_mutex_unlock(&ms);
|
||||
|
||||
// file overwrite enable
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
pthread_mutex_lock(&ms);
|
||||
parentDet->enableOverwriteMask(ind);
|
||||
pthread_mutex_unlock(&ms);
|
||||
|
||||
// streaming port
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->zmqport = ind;
|
||||
|
||||
if (!n) printf("n: %d\n", n);
|
||||
|
||||
return OK;
|
||||
@ -8132,12 +8253,14 @@ int slsDetector::updateReceiver() {
|
||||
if (connectData() == OK){
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret!=FAIL)
|
||||
updateReceiverNoWait();
|
||||
else{
|
||||
if (ret == FAIL) {
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Receiver returned error: " << mess << std::endl;
|
||||
}
|
||||
else
|
||||
updateReceiverNoWait();
|
||||
|
||||
//if ret is force update, do not update now as client is updating receiver currently
|
||||
disconnectData();
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +269,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
bool acquiringFlag;
|
||||
/** flipped data across x or y axis */
|
||||
int flippedData[2];
|
||||
|
||||
/** tcp port between receiver and gui (only data) */
|
||||
int zmqport;
|
||||
|
||||
} sharedSlsDetector;
|
||||
|
||||
@ -886,7 +887,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
set dacs value
|
||||
\param index ADC index
|
||||
\param imod module number
|
||||
\returns current ADC value
|
||||
\returns current ADC value (temperature for eiger and jungfrau in millidegrees)
|
||||
*/
|
||||
dacs_t getADC(dacIndex index, int imod=0);
|
||||
|
||||
@ -965,10 +966,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
\param e_eV threashold in eV (detector specific)
|
||||
\param gainval pointer to extra gain values
|
||||
\param offsetval pointer to extra offset values
|
||||
\param tb 1 to include trimbits, 0 to exclude (used for eiger)
|
||||
\returns current register value
|
||||
\sa ::sls_detector_module
|
||||
*/
|
||||
int setModule(sls_detector_module module, int iodelay, int tau, int e_eV, int* gainval=0, int* offsetval=0);
|
||||
int setModule(sls_detector_module module, int iodelay, int tau, int e_eV, int* gainval=0, int* offsetval=0, int tb=1);
|
||||
//virtual int setModule(sls_detector_module module);
|
||||
|
||||
/**
|
||||
@ -999,17 +1001,19 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
\param e_eV threshold in eV
|
||||
\param imod module number (-1 all)
|
||||
\param isettings ev. change settings
|
||||
\param tb 1 to include trimbits, 0 to exclude
|
||||
\returns current threshold value for imod in ev (-1 failed)
|
||||
*/
|
||||
int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS);
|
||||
int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS, int tb=1);
|
||||
|
||||
/**
|
||||
set threshold energy
|
||||
\param e_eV threshold in eV
|
||||
\param isettings ev. change settings
|
||||
\param tb 1 to include trimbits, 0 to exclude
|
||||
\returns OK if successful, else FAIL
|
||||
*/
|
||||
int setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings);
|
||||
int setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings, int tb=1);
|
||||
|
||||
/**
|
||||
get detector settings
|
||||
@ -1059,6 +1063,17 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
|
||||
// Acquisition functions
|
||||
|
||||
/**
|
||||
prepares detector for acquisition
|
||||
\returns OK/FAIL
|
||||
*/
|
||||
int prepareAcquisition();
|
||||
|
||||
/**
|
||||
prepares detector for acquisition
|
||||
\returns OK/FAIL
|
||||
*/
|
||||
int cleanupAcquisition();
|
||||
|
||||
/**
|
||||
start detector acquisition
|
||||
@ -1610,10 +1625,6 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
runStatus startReceiverReadout();
|
||||
|
||||
/** Sets(false) or Resets(true) the CPU bit in detector
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
int detectorSendToReceiver(bool set);
|
||||
|
||||
/** gets the status of the listening mode of receiver
|
||||
\returns status
|
||||
@ -1717,6 +1728,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
string getReceiverUDPPort() {ostringstream ss; ss << thisDetector->receiverUDPPort; string s = ss.str(); return s;};
|
||||
/** returns the receiver UDP2 for Eiger IP address \sa sharedSlsDetector */
|
||||
string getReceiverUDPPort2() {ostringstream ss; ss << thisDetector->receiverUDPPort2; string s = ss.str(); return s;};
|
||||
/** returns the zmq port \sa sharedSlsDetector */
|
||||
string getReceiverStreamingPort() {ostringstream ss; ss << thisDetector->zmqport; string s = ss.str(); return s;};
|
||||
|
||||
/** validates the format of detector MAC address and sets it \sa sharedSlsDetector */
|
||||
string setDetectorMAC(string detectorMAC);
|
||||
@ -1732,6 +1745,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
int setReceiverUDPPort(int udpport);
|
||||
/** sets the receiver udp port2 for Eiger \sa sharedSlsDetector */
|
||||
int setReceiverUDPPort2(int udpport);
|
||||
/** sets the zmq port in client and receiver (includes "multi" at the end if it should calculate individual ports \sa sharedSlsDetector */
|
||||
int setReceiverStreamingPort(string port);
|
||||
/** sets the transmission delay for left or right port or for an entire frame*/
|
||||
string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
|
||||
|
@ -207,7 +207,7 @@ class slsDetectorActions : public virtual slsDetectorBase
|
||||
/* *\/ */
|
||||
/* virtual detectorType getDetectorsType(int pos=-1)=0; */
|
||||
|
||||
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0;
|
||||
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS, int tb=1)=0;
|
||||
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;
|
||||
|
||||
|
||||
|
@ -429,7 +429,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
virtual externalCommunicationMode setExternalCommunicationMode(externalCommunicationMode pol=GET_EXTERNAL_COMMUNICATION_MODE)=0;
|
||||
int setTimingMode(int i=-1){return slsDetectorUsers::getTimingMode( externalCommunicationType( setExternalCommunicationMode(externalCommunicationType( slsDetectorUsers::getTimingMode(i) ) ) ) );};
|
||||
|
||||
virtual int setThresholdEnergy(int e_eV, int imod, detectorSettings isettings=GET_SETTINGS)=0;
|
||||
virtual int setThresholdEnergy(int e_eV, int imod, detectorSettings isettings=GET_SETTINGS, int tb=1)=0;
|
||||
int setThresholdEnergy(int e_eV){return setThresholdEnergy(e_eV,-1);};
|
||||
|
||||
|
||||
@ -751,6 +751,30 @@ virtual void readFrameFromReceiver()=0;
|
||||
default: return string("unknown"); \
|
||||
}};
|
||||
|
||||
/** returns string from timer index
|
||||
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME
|
||||
\returns string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time
|
||||
*/
|
||||
static string getTimerType(timerIndex t){ \
|
||||
switch (t) { \
|
||||
case FRAME_NUMBER: return string("frame_number"); \
|
||||
case ACQUISITION_TIME: return string("acquisition_time"); \
|
||||
case FRAME_PERIOD: return string("frame_period"); \
|
||||
case DELAY_AFTER_TRIGGER: return string("delay_after_trigger"); \
|
||||
case GATES_NUMBER: return string("gates_number"); \
|
||||
case PROBES_NUMBER: return string("probes_number"); \
|
||||
case CYCLES_NUMBER: return string("cycles_number"); \
|
||||
case ACTUAL_TIME: return string("actual_time"); \
|
||||
case MEASUREMENT_TIME: return string("measurement_time"); \
|
||||
case PROGRESS: return string("progress"); \
|
||||
case MEASUREMENTS_NUMBER: return string("measurements_number"); \
|
||||
case FRAMES_FROM_START: return string("frames_from_start"); \
|
||||
case FRAMES_FROM_START_PG: return string("frames_from_start_pg"); \
|
||||
case SAMPLES_JCTB: return string("samples_jctb"); \
|
||||
case SUBFRAME_ACQUISITION_TIME: return string("subframe_acquisition_time"); \
|
||||
default: return string("unknown"); \
|
||||
}};
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
@ -37,6 +37,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdStatus;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="busy"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdStatus;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="datastream"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDataStream;
|
||||
i++;
|
||||
@ -386,6 +390,11 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="zmqport"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
||||
i++;
|
||||
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="configuremac"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdConfigureMac;
|
||||
i++;
|
||||
@ -564,6 +573,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="thresholdnotb"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="trimbits"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||
i++;
|
||||
@ -1320,7 +1333,7 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
if (myDet->setReceiverOnline(ONLINE_FLAG) == ONLINE_FLAG) {
|
||||
//if it was not off
|
||||
// command line: must be off, if receiver on or there was -1, then
|
||||
if (myDet->enableDataStreamingFromReceiver(-1) != 0){
|
||||
//switch it off, if error
|
||||
if (myDet->enableDataStreamingFromReceiver(0) != 0) {
|
||||
@ -1431,20 +1444,33 @@ string slsDetectorCommand::cmdStatus(int narg, char *args[], int action) {
|
||||
#ifdef VERBOSE
|
||||
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
||||
#endif
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
//myDet->setThreadedProcessing(0);
|
||||
if (string(args[1])=="start")
|
||||
myDet->startAcquisition();
|
||||
else if (string(args[1])=="stop")
|
||||
myDet->stopAcquisition();
|
||||
else
|
||||
return string("unknown action");
|
||||
} else if (action==HELP_ACTION) {
|
||||
return helpStatus(narg,args,HELP_ACTION);
|
||||
|
||||
if (action==HELP_ACTION)
|
||||
return helpStatus(narg,args,action);
|
||||
|
||||
if (cmd=="status") {
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
//myDet->setThreadedProcessing(0);
|
||||
if (string(args[1])=="start")
|
||||
myDet->startAcquisition();
|
||||
else if (string(args[1])=="stop")
|
||||
myDet->stopAcquisition();
|
||||
else
|
||||
return string("unknown action");
|
||||
}
|
||||
runStatus s=myDet->getRunStatus();
|
||||
return myDet->runStatusType(s);
|
||||
}
|
||||
runStatus s=myDet->getRunStatus();
|
||||
return myDet->runStatusType(s);
|
||||
else if (cmd=="busy") {
|
||||
if (action==PUT_ACTION) {
|
||||
return string ("cannot put");
|
||||
}
|
||||
char answer[100];
|
||||
sprintf(answer,"%d", myDet->getAcquiringFlag());
|
||||
return string(answer);
|
||||
}
|
||||
else return string("cannot scan command ")+string(cmd);
|
||||
|
||||
}
|
||||
|
||||
@ -1453,8 +1479,10 @@ string slsDetectorCommand::cmdStatus(int narg, char *args[], int action) {
|
||||
string slsDetectorCommand::helpStatus(int narg, char *args[], int action) {
|
||||
|
||||
ostringstream os;
|
||||
if (action==GET_ACTION || action==HELP_ACTION)
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << string("status \t gets the detector status - can be: running, error, transmitting, finished, waiting or idle\n");
|
||||
os << string("busy \t gets the status of acquire- can be: 0 or 1. 0 for idle, 1 for running\n");
|
||||
}
|
||||
if (action==PUT_ACTION || action==HELP_ACTION)
|
||||
os << string("status \t controls the detector acquisition - can be start or stop \n");
|
||||
return os.str();
|
||||
@ -2932,6 +2960,12 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio
|
||||
if (!(sscanf(args[1],"%d",&i)))
|
||||
return ("cannot parse argument") + string(args[1]);
|
||||
}
|
||||
}else if (cmd=="zmqport") {
|
||||
t=RECEIVER_STREAMING_PORT;
|
||||
if (action==PUT_ACTION){
|
||||
if (!(sscanf(args[1],"%d",&i)))
|
||||
return ("cannot parse argument") + string(args[1]);
|
||||
}
|
||||
}else return ("unknown network parameter")+cmd;
|
||||
|
||||
if (action==PUT_ACTION)
|
||||
@ -2957,6 +2991,7 @@ string slsDetectorCommand::helpNetworkParameter(int narg, char *args[], int acti
|
||||
os << "txndelay_right port \n sets detector transmission delay of the right port"<< std::endl;
|
||||
os << "txndelay_frame port \n sets detector transmission delay of the entire frame"<< std::endl;
|
||||
os << "flowcontrol_10g port \n sets flow control for 10g for eiger"<< std::endl;
|
||||
os << "zmqport port \n sets zmq port (data from receiver to client); setting via multidetector command calculates port for individual detectors"<< std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "detectormac \n gets detector mac "<< std::endl;
|
||||
@ -2969,6 +3004,7 @@ string slsDetectorCommand::helpNetworkParameter(int narg, char *args[], int acti
|
||||
os << "txndelay_right \n gets detector transmission delay of the right port"<< std::endl;
|
||||
os << "txndelay_frame \n gets detector transmission delay of the entire frame"<< std::endl;
|
||||
os << "flowcontrol_10g \n gets flow control for 10g for eiger"<< std::endl;
|
||||
os << "zmqport \n gets zmq port (data from receiver to client)"<< std::endl;
|
||||
}
|
||||
return os.str();
|
||||
|
||||
@ -3326,9 +3362,9 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
return string("unknown detector size ")+cmd;
|
||||
|
||||
if (cmd=="roimask")
|
||||
sprintf(ans,"%x",ret);
|
||||
sprintf(ans,"0x%x",ret);
|
||||
else
|
||||
sprintf(ans,"%d",ret);
|
||||
sprintf(ans,"0x%d",ret);
|
||||
|
||||
return string(ans);
|
||||
|
||||
@ -3390,10 +3426,10 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
|
||||
return myDet->getDetectorSettings(myDet->getSettings());
|
||||
} else if (cmd=="threshold") {
|
||||
if (action==PUT_ACTION) {
|
||||
detectorType type = myDet->getDetectorsType();
|
||||
if (!sscanf(args[1],"%d",&val)) {
|
||||
return string("invalid threshold value");
|
||||
}
|
||||
detectorType type = myDet->getDetectorsType();
|
||||
if (type != EIGER || (type == EIGER && narg<=2)) {
|
||||
myDet->setThresholdEnergy(val);
|
||||
} else {
|
||||
@ -3405,6 +3441,25 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
|
||||
}
|
||||
sprintf(ans,"%d",myDet->getThresholdEnergy());
|
||||
return string(ans);
|
||||
} else if (cmd=="thresholdnotb") {
|
||||
if (action==PUT_ACTION) {
|
||||
if (!sscanf(args[1],"%d",&val)) {
|
||||
return string("invalid threshold value");
|
||||
}
|
||||
detectorType type = myDet->getDetectorsType();
|
||||
if (type != EIGER)
|
||||
return string("not implemented for this detector");
|
||||
if (narg<=2) {
|
||||
myDet->setThresholdEnergy(val, -1, GET_SETTINGS, 0);
|
||||
} else {
|
||||
detectorSettings sett= myDet->getDetectorSettings(string(args[2]));
|
||||
if(sett == -1)
|
||||
return string("invalid settings value");
|
||||
myDet->setThresholdEnergy(val, -1, sett, 0);
|
||||
}
|
||||
}
|
||||
sprintf(ans,"%d",myDet->getThresholdEnergy());
|
||||
return string(ans);
|
||||
} else if (cmd=="trimbits") {
|
||||
if (narg>=2) {
|
||||
string sval=string(args[1]);
|
||||
@ -3487,7 +3542,8 @@ string slsDetectorCommand::helpSettings(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "settings s \n sets the settings of the detector - can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain"
|
||||
"lownoise, dynamichg0,fixgain1,fixgain2,forceswitchg1, forceswitchg2"<< std::endl;
|
||||
os << "threshold eV\n sets the detector threshold in eV"<< std::endl;
|
||||
os << "threshold eV [sett]\n sets the detector threshold in eV. If sett is provided for eiger, uses settings sett"<< std::endl;
|
||||
os << "thresholdnotb eV [sett]\n sets the detector threshold in eV without loading trimbits. If sett is provided for eiger, uses settings sett"<< std::endl;
|
||||
os << "trimbits fname\n loads the trimfile fname to the detector. If no extension is specified, the serial number of each module will be attached."<< std::endl;
|
||||
os << "trim:mode fname\n trims the detector according to mode (can be noise, beam, improve, fix) and saves the resulting trimbits to file fname."<< std::endl;
|
||||
os << "trimval i \n sets all the trimbits to i" << std::endl;
|
||||
@ -3497,6 +3553,7 @@ string slsDetectorCommand::helpSettings(int narg, char *args[], int action) {
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "settings \n gets the settings of the detector"<< std::endl;
|
||||
os << "threshold V\n gets the detector threshold"<< std::endl;
|
||||
os << "thresholdnotb V\n gets the detector threshold"<< std::endl;
|
||||
os << "trimbits [fname]\n returns the trimfile loaded on the detector. If fname is specified the trimbits are saved to file. If no extension is specified, the serial number of each module will be attached."<< std::endl;
|
||||
os << "trimval \n returns the value all trimbits are set to. If they are different, returns -1." << std::endl;
|
||||
}
|
||||
@ -3532,7 +3589,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
||||
if (retval < 0)
|
||||
sprintf(answer, "%d", -1);
|
||||
else
|
||||
sprintf(answer,"%lx", retval);
|
||||
sprintf(answer,"0x%lx", retval);
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
@ -3546,7 +3603,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
||||
if (retval < 0)
|
||||
sprintf(answer, "%d", -1);
|
||||
else
|
||||
sprintf(answer,"%lx", retval);
|
||||
sprintf(answer,"0x%lx", retval);
|
||||
return string(answer);
|
||||
} else
|
||||
return string("undefined module number");
|
||||
@ -3556,7 +3613,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
||||
if (retval < 0)
|
||||
sprintf(answer, "%d", -1);
|
||||
else
|
||||
sprintf(answer,"%lx", retval);
|
||||
sprintf(answer,"0x%lx", retval);
|
||||
return string(answer);
|
||||
}
|
||||
if (cmd.find("modulenumber")!=string::npos) {
|
||||
@ -3566,7 +3623,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
||||
if (retval < 0)
|
||||
sprintf(answer, "%d", -1);
|
||||
else
|
||||
sprintf(answer,"%lx", retval);
|
||||
sprintf(answer,"0x%lx", retval);
|
||||
return string(answer);
|
||||
} else
|
||||
return string("undefined module number");
|
||||
@ -3577,7 +3634,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
||||
if (retval < 0)
|
||||
sprintf(answer, "%d", -1);
|
||||
else
|
||||
sprintf(answer,"%lx", retval);
|
||||
sprintf(answer,"0x%lx", retval);
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
@ -3586,7 +3643,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
||||
if (retval < 0)
|
||||
sprintf(answer, "%d", -1);
|
||||
else
|
||||
sprintf(answer,"%lx", retval);
|
||||
sprintf(answer,"0x%lx", retval);
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
@ -3596,7 +3653,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
||||
if (retval < 0)
|
||||
sprintf(answer, "%d", -1);
|
||||
else
|
||||
sprintf(answer,"%lx", retval);
|
||||
sprintf(answer,"0x%lx", retval);
|
||||
return string(answer);
|
||||
}
|
||||
return string("unknown id mode ")+cmd;
|
||||
@ -3635,7 +3692,7 @@ string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action) {
|
||||
if (cmd=="bustest"){
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot set ")+cmd;
|
||||
sprintf(answer,"%x",myDet->digitalTest(DETECTOR_BUS_TEST));
|
||||
sprintf(answer,"0x%x",myDet->digitalTest(DETECTOR_BUS_TEST));
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
@ -3644,7 +3701,7 @@ string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action) {
|
||||
return string("cannot set ")+cmd;
|
||||
int ival=-1;
|
||||
if (sscanf(args[0],"digitest:%d",&ival)) {
|
||||
sprintf(answer,"%x",myDet->digitalTest(CHIP_TEST, ival));
|
||||
sprintf(answer,"0x%x",myDet->digitalTest(CHIP_TEST, ival));
|
||||
return string(answer);
|
||||
} else
|
||||
return string("undefined module number");
|
||||
@ -3656,7 +3713,7 @@ string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action) {
|
||||
int ival=-1;
|
||||
if (sscanf(args[1],"%d",&ival)) {
|
||||
if((ival==0)||(ival==1)){
|
||||
sprintf(answer,"%x",myDet->digitalTest(DIGITAL_BIT_TEST,ival));
|
||||
sprintf(answer,"0x%x",myDet->digitalTest(DIGITAL_BIT_TEST,ival));
|
||||
return string(answer);
|
||||
}
|
||||
else
|
||||
@ -3729,13 +3786,13 @@ string slsDetectorCommand::cmdRegister(int narg, char *args[], int action) {
|
||||
;
|
||||
else
|
||||
return string("Could not scan value (hexadecimal fomat) ")+string(args[2]);
|
||||
sprintf(answer,"%x",myDet->writeRegister(addr,val));
|
||||
sprintf(answer,"0x%x",myDet->writeRegister(addr,val));
|
||||
} else if (cmd=="adcreg") {
|
||||
if (sscanf(args[2],"%x",&val))
|
||||
;
|
||||
else
|
||||
return string("Could not scan value (hexadecimal fomat) ")+string(args[2]);
|
||||
sprintf(answer,"%x",myDet->writeAdcRegister(addr,val));
|
||||
sprintf(answer,"0x%x",myDet->writeAdcRegister(addr,val));
|
||||
} else {
|
||||
|
||||
if (sscanf(args[2],"%d",&n))
|
||||
@ -3747,9 +3804,9 @@ string slsDetectorCommand::cmdRegister(int narg, char *args[], int action) {
|
||||
return string("Bit number out of range")+string(args[2]);
|
||||
|
||||
if (cmd=="setbit")
|
||||
sprintf(answer,"%x",myDet->writeRegister(addr,myDet->readRegister(addr)| 1<<n));
|
||||
sprintf(answer,"0x%x",myDet->writeRegister(addr,myDet->readRegister(addr)| 1<<n));
|
||||
if (cmd=="clearbit")
|
||||
sprintf(answer,"%x",myDet->writeRegister(addr,myDet->readRegister(addr) & ~(1<<n)));
|
||||
sprintf(answer,"0x%x",myDet->writeRegister(addr,myDet->readRegister(addr) & ~(1<<n)));
|
||||
}
|
||||
|
||||
|
||||
@ -3770,7 +3827,7 @@ string slsDetectorCommand::cmdRegister(int narg, char *args[], int action) {
|
||||
return string("Could not scan address (hexadecimal fomat) ")+string(args[1]);
|
||||
|
||||
|
||||
sprintf(answer,"%x",myDet->readRegister(addr));
|
||||
sprintf(answer,"0x%x",myDet->readRegister(addr));
|
||||
|
||||
}
|
||||
|
||||
@ -3807,7 +3864,7 @@ string slsDetectorCommand::helpRegister(int narg, char *args[], int action) {
|
||||
|
||||
ostringstream os;
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "reg addr val \n writes the register addr with the value val"<< std::endl;
|
||||
os << "reg addr val \n writes the register addr with the value val (hexadecimal format)"<< std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "reg addr \n reads the register addr"<< std::endl;
|
||||
@ -4179,7 +4236,7 @@ string slsDetectorCommand::cmdADC(int narg, char *args[], int action) {
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
#ifdef DACS_INT
|
||||
if (myDet->getDetectorsType() == EIGER)
|
||||
if (myDet->getDetectorsType() == EIGER || myDet->getDetectorsType() == JUNGFRAU)
|
||||
sprintf(answer,"%.2f",(double)myDet->getADC(adc)/1000.00);
|
||||
else sprintf(answer,"%d",myDet->getADC(adc));
|
||||
#else
|
||||
@ -4305,7 +4362,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
ret=myDet->setTimer(index,t);
|
||||
if (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
|
||||
if ((ret!=-1) && (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER))
|
||||
rval=(double)ret*1E-9;
|
||||
else rval=ret;
|
||||
|
||||
@ -4318,8 +4375,10 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
myDet->setFrameIndex(-1);
|
||||
}
|
||||
|
||||
|
||||
sprintf(answer,"%0.9f",rval);
|
||||
if (index==FRAME_NUMBER || index==GATES_NUMBER || index==PROBES_NUMBER || index==CYCLES_NUMBER || index==MEASUREMENTS_NUMBER)
|
||||
sprintf(answer,"%d",(int)rval);
|
||||
else
|
||||
sprintf(answer,"%0.9f",rval);
|
||||
return string(answer);
|
||||
|
||||
|
||||
|
@ -42,11 +42,7 @@ slsDetectorUtils::slsDetectorUtils() {
|
||||
|
||||
|
||||
int slsDetectorUtils::acquire(int delflag){
|
||||
struct timespec begin,end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
|
||||
|
||||
//ensure acquire isnt started multiple times by same client
|
||||
//ensure acquire isnt started multiple times by same client
|
||||
if(getAcquiringFlag() == false)
|
||||
setAcquiringFlag(true);
|
||||
else{
|
||||
@ -54,6 +50,9 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
struct timespec begin,end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
|
||||
//not in the loop for real time acqusition yet,
|
||||
//in the real time acquisition loop, processing thread will wait for a post each time
|
||||
sem_init(&sem_newRTAcquisition,1,0);
|
||||
@ -509,8 +508,9 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
sem_destroy(&sem_newRTAcquisition);
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
#ifdef VERBOSE
|
||||
cout << "Elapsed time for acquisition:" << (( end.tv_sec - begin.tv_sec ) + ( end.tv_nsec - begin.tv_nsec ) / 1000000000.0) << " seconds" << endl;
|
||||
|
||||
#endif
|
||||
return OK;
|
||||
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
// double* convertAngles(){return convertAngles(currentPosition);};
|
||||
// virtual double* convertAngles(double pos)=0;
|
||||
|
||||
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0;
|
||||
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS, int tb=1)=0;
|
||||
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;
|
||||
|
||||
virtual double getRateCorrectionTau()=0;
|
||||
@ -555,7 +555,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
\param imod module number
|
||||
\returns current ADC value
|
||||
*/
|
||||
virtual dacs_t getADC(dacIndex index, int imod=0)=0;
|
||||
virtual dacs_t getADC(dacIndex index, int imod=-1)=0;
|
||||
|
||||
/**
|
||||
get the maximum size of the detector
|
||||
|
@ -138,7 +138,7 @@ int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset)
|
||||
|
||||
|
||||
|
||||
slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detectorType myDetectorType, sls_detector_module* a, sls_detector_module* b, const int energy, const int e1, const int e2){
|
||||
slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detectorType myDetectorType, sls_detector_module* a, sls_detector_module* b, const int energy, const int e1, const int e2, int tb){
|
||||
// only implemented for eiger currently (in terms of which dacs)
|
||||
if(myDetectorType != EIGER) {
|
||||
printf("Interpolation of Trim values not implemented for this detector!\n");
|
||||
@ -168,8 +168,10 @@ slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detector
|
||||
}
|
||||
|
||||
//Interpolate all trimbits
|
||||
for (int i = 0; i<myMod->nchan; i++)
|
||||
myMod->chanregs[i] = linearInterpolation(energy, e1, e2, a->chanregs[i], b->chanregs[i]);
|
||||
if(tb) {
|
||||
for (int i = 0; i<myMod->nchan; i++)
|
||||
myMod->chanregs[i] = linearInterpolation(energy, e1, e2, a->chanregs[i], b->chanregs[i]);
|
||||
}
|
||||
return myMod;
|
||||
}
|
||||
|
||||
@ -180,7 +182,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detector
|
||||
/* I/O */
|
||||
|
||||
|
||||
slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod){
|
||||
slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod, int tb){
|
||||
|
||||
|
||||
|
||||
@ -372,19 +374,21 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
||||
infile.read((char*) myMod->dacs,sizeof(dacs_t)*(myMod->ndac));
|
||||
infile.read((char*)&iodelay,sizeof(iodelay));
|
||||
infile.read((char*)&tau,sizeof(tau));
|
||||
infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
|
||||
#ifdef VERBOSE
|
||||
for(int i=0;i<myMod->ndac;i++)
|
||||
std::cout << "dac " << i << ":" << myMod->dacs[i] << std::endl;
|
||||
std::cout << "iodelay:" << iodelay << std::endl;
|
||||
std::cout << "tau:" << tau << std::endl;
|
||||
#endif
|
||||
if(infile.eof()){
|
||||
cout<<endl<<"Error, could not load trimbits end of file, "<<myfname<<", reached."<<endl<<endl;
|
||||
if (nflag)
|
||||
deleteModule(myMod);
|
||||
if(tb) {
|
||||
infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
|
||||
if(infile.eof()){
|
||||
cout<<endl<<"Error, could not load trimbits end of file, "<<myfname<<", reached."<<endl<<endl;
|
||||
if (nflag)
|
||||
deleteModule(myMod);
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
infile.close();
|
||||
strcpy(settingsFile,fname.c_str());
|
||||
|
@ -88,9 +88,10 @@ class energyConversion
|
||||
\param energy energy to trim at
|
||||
\param e1 reference trim value
|
||||
\param e2 reference trim value
|
||||
\param tb 1 to include trimbits, 0 to exclude (used for eiger)
|
||||
\returns the pointer to the module structure with interpolated values or NULL if error
|
||||
*/
|
||||
sls_detector_module* interpolateTrim(detectorType myDetectorType, sls_detector_module* a, sls_detector_module* b, const int energy, const int e1, const int e2);
|
||||
sls_detector_module* interpolateTrim(detectorType myDetectorType, sls_detector_module* a, sls_detector_module* b, const int energy, const int e1, const int e2, int tb=1);
|
||||
|
||||
|
||||
|
||||
@ -103,10 +104,11 @@ class energyConversion
|
||||
\param iodelay io delay (detector specific)
|
||||
\param tau tau (detector specific)
|
||||
\param myMod pointer to the module structure which has to be set. <BR> If it is NULL a new module structure will be created
|
||||
\param tb 1 to include trimbits, 0 to exclude (used for eiger)
|
||||
\returns the pointer to myMod or NULL if reading the file failed
|
||||
*/
|
||||
|
||||
sls_detector_module* readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod=NULL);
|
||||
sls_detector_module* readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod=NULL, int tb=1);
|
||||
|
||||
/**
|
||||
writes a trim/settings file
|
||||
|
@ -1,96 +1,98 @@
|
||||
include ../../Makefile.include
|
||||
|
||||
CFLAGS= -DC_ONLY
|
||||
#FLAGS=-DVERBOSE
|
||||
#ASM=$(shell echo "/lib/modules/`uname -r`/build/include")
|
||||
|
||||
#INCLUDES= -I../slsDetectorSoftware/commonFiles -I../slsDetectorSoftware/slsDetector -I ../slsDetectorSoftware/MySocketTCP -I../slsDetectorSoftware/usersFunctions -I../slsDetectorSoftware/multiSlsDetector -I../slsDetectorSoftware/slsDetectorAnalysis -I../slsDetectorSoftware/slsReceiverInterface -I$(ASM)
|
||||
#LDFLAG=
|
||||
|
||||
|
||||
|
||||
INCLUDES?= -I../commonFiles -I../slsDetector -I ../MySocketTCP -I../usersFunctions -I../multiSlsDetector -I../slsDetectorAnalysis -I../slsReceiverInterface -I$(shell echo "/lib/modules/`uname -r`/build/include")
|
||||
|
||||
|
||||
LIBDIR?=../
|
||||
LIBS?= -L$(LIBDIR) -lSlsDetector
|
||||
|
||||
LDFLAG= -L/usr/lib64/ -pthread
|
||||
|
||||
|
||||
DESTDIR ?= bin
|
||||
DOCDIR ?= $(PWD)/docs
|
||||
|
||||
INCLUDES?= -I../commonFiles -I../slsDetector -I ../MySocketTCP -I../usersFunctions -I../multiSlsDetector -I../slsDetectorAnalysis -I../slsReceiverInterface -I ../../slsReceiverSoftware/include -I$(shell echo "/lib/modules/`uname -r`/build/include")
|
||||
DESTDIR ?= ../../bin
|
||||
BIN=$(DESTDIR)
|
||||
|
||||
LIBS?= -L$(DESTDIR) -lSlsDetector
|
||||
LIBRARYDIR?=../
|
||||
LDFLAG= -L/usr/lib64/ -pthread
|
||||
DOCDIR ?= $(PWD)/docs
|
||||
SRC_CLNT=sls_detector_client.cpp
|
||||
|
||||
clients: $(DESTDIR)/sls_detector_put $(DESTDIR)/sls_detector_get $(DESTDIR)/sls_detector_acquire $(DESTDIR)/sls_detector_help
|
||||
echo $(LIBS)
|
||||
|
||||
static_clients: $(DESTDIR)/ssls_detector_put $(DESTDIR)/ssls_detector_get $(DESTDIR)/ssls_detector_acquire $(DESTDIR)/ssls_detector_help
|
||||
$(info )
|
||||
$(info #######################################)
|
||||
$(info # In slsDetectorclient Makefile #)
|
||||
$(info #######################################)
|
||||
$(info )
|
||||
|
||||
all: clients
|
||||
echo $(LIBS)
|
||||
|
||||
nonstatic: clients
|
||||
|
||||
clients: builddir lib $(DESTDIR)/sls_detector_put $(DESTDIR)/sls_detector_get $(DESTDIR)/sls_detector_acquire $(DESTDIR)/sls_detector_help
|
||||
|
||||
static_clients: builddir lib $(DESTDIR)/ssls_detector_put $(DESTDIR)/ssls_detector_get $(DESTDIR)/ssls_detector_acquire $(DESTDIR)/ssls_detector_help
|
||||
|
||||
lib:
|
||||
cd ../ && $(MAKE) DESTDIR=$(LIBDIR)
|
||||
|
||||
|
||||
|
||||
$(DESTDIR)/ssls_detector_put: $(SRC_CLNT) lib
|
||||
echo $(LIBS)
|
||||
echo $(LDFLAG)
|
||||
builddir:
|
||||
# echo $(LIBS)
|
||||
# echo $(LDFLAG)
|
||||
mkdir -p $(BIN)
|
||||
|
||||
lib:
|
||||
# echo $(LIBDIR)
|
||||
cd $(LIBRARYDIR) && $(MAKE) DESTDIR=$(DESTDIR) TABSPACE='$(TABSPACE)'
|
||||
@echo ""
|
||||
@echo "#######################################"
|
||||
@echo "# Back in slsDetectorClient Makefile #"
|
||||
@echo "#######################################"
|
||||
@echo ""
|
||||
|
||||
$(DESTDIR)/ssls_detector_put: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
||||
$(call colorecho,"#######################################")
|
||||
$(call colorecho,"# Compiling ssls_detector_put #")
|
||||
$(call colorecho,"#######################################")
|
||||
$(CXX) -static -o $(BIN)/ssls_detector_put $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DPUT $(LIBS) $(LDFLAG)
|
||||
|
||||
$(DESTDIR)/ssls_detector_get: $(SRC_CLNT) lib
|
||||
echo $(LIBS)
|
||||
echo $(LDFLAG)
|
||||
mkdir -p $(BIN)
|
||||
$(DESTDIR)/ssls_detector_get: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
||||
$(call colorecho,"#######################################")
|
||||
$(call colorecho,"# Compiling ssls_detector_get #")
|
||||
$(call colorecho,"#######################################")
|
||||
$(CXX) -static -o $(BIN)/ssls_detector_get $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DGET $(LIBS) $(LDFLAG)
|
||||
|
||||
$(DESTDIR)/ssls_detector_acquire: $(SRC_CLNT) lib
|
||||
echo $(LIBS)
|
||||
echo $(LDFLAG)
|
||||
mkdir -p $(BIN)
|
||||
$(DESTDIR)/ssls_detector_acquire: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
||||
$(call colorecho,"#######################################")
|
||||
$(call colorecho,"# Compiling ssls_detector_acquire #")
|
||||
$(call colorecho,"#######################################")
|
||||
$(CXX) -static -o $(BIN)/ssls_detector_acquire $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DREADOUT $(LIBS) $(LDFLAG)
|
||||
|
||||
$(DESTDIR)/ssls_detector_help: $(SRC_CLNT) lib
|
||||
echo $(LIBS)
|
||||
echo $(LDFLAG)
|
||||
mkdir -p $(BIN)
|
||||
$(DESTDIR)/ssls_detector_help: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
||||
$(call colorecho,"#######################################")
|
||||
$(call colorecho,"# Compiling ssls_detector_help #")
|
||||
$(call colorecho,"#######################################")
|
||||
$(CXX) -static -o $(BIN)/ssls_detector_help $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DHELP $(LIBS) $(LDFLAG)
|
||||
|
||||
|
||||
|
||||
$(DESTDIR)/sls_detector_put: $(SRC_CLNT) lib
|
||||
echo $(LIBS)
|
||||
echo $(LDFLAG)
|
||||
mkdir -p $(BIN)
|
||||
$(DESTDIR)/sls_detector_put: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
||||
$(call colorecho,"#######################################")
|
||||
$(call colorecho,"# Compiling sls_detector_put #")
|
||||
$(call colorecho,"#######################################")
|
||||
$(CXX) -o $(BIN)/sls_detector_put $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DPUT $(LIBS) $(LDFLAG)
|
||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
||||
|
||||
$(DESTDIR)/sls_detector_get: $(SRC_CLNT) lib
|
||||
echo $(LIBS)
|
||||
echo $(LDFLAG)
|
||||
mkdir -p $(BIN)
|
||||
$(DESTDIR)/sls_detector_get: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
||||
$(call colorecho,"#######################################")
|
||||
$(call colorecho,"# Compiling sls_detector_get #")
|
||||
$(call colorecho,"#######################################")
|
||||
$(CXX) -o $(BIN)/sls_detector_get $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DGET $(LIBS) $(LDFLAG)
|
||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
||||
|
||||
$(DESTDIR)/sls_detector_acquire: $(SRC_CLNT) lib
|
||||
echo $(LIBS)
|
||||
echo $(LDFLAG)
|
||||
mkdir -p $(BIN)
|
||||
$(DESTDIR)/sls_detector_acquire: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
||||
$(call colorecho,"#######################################")
|
||||
$(call colorecho,"# Compiling sls_detector_acquire #")
|
||||
$(call colorecho,"#######################################")
|
||||
$(CXX) -o $(BIN)/sls_detector_acquire $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DREADOUT $(LIBS) $(LDFLAG)
|
||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
||||
|
||||
$(DESTDIR)/sls_detector_help: $(SRC_CLNT) lib
|
||||
echo $(LIBS)
|
||||
echo $(LDFLAG)
|
||||
mkdir -p $(BIN)
|
||||
$(DESTDIR)/sls_detector_help: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
||||
$(call colorecho,"#######################################")
|
||||
$(call colorecho,"# Compiling sls_detector_help #")
|
||||
$(call colorecho,"#######################################")
|
||||
$(CXX) -o $(BIN)/sls_detector_help $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DHELP $(LIBS) $(LDFLAG)
|
||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
||||
|
||||
@ -107,6 +109,3 @@ clean:
|
||||
|
||||
install: clients
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
#ifndef COMMON_SERVER_FUNCTIONS_H
|
||||
#define COMMON_SERVER_FUNCTIONS_H
|
||||
|
||||
#ifndef GOTTHARDD //gotthard already had bus_w etc defined in its firmware_funcs.c (not yet made with common files)
|
||||
#include "blackfin.h"
|
||||
#endif
|
||||
|
||||
/* global variables */
|
||||
void serializeToSPI(u_int32_t addr, u_int32_t val, u_int16_t csmask, int numbitstosend, u_int16_t clkmask, u_int16_t digoutmask, int digofset) {
|
||||
|
@ -59,6 +59,9 @@ void setupDetector();
|
||||
#ifndef EIGERD
|
||||
extern u_int32_t writeRegister(u_int32_t offset, u_int32_t data); // blackfin.h
|
||||
extern u_int32_t readRegister(u_int32_t offset); // blackfin.h
|
||||
#else
|
||||
uint32_t writeRegister(uint32_t offset, uint32_t data);
|
||||
uint32_t readRegister(uint32_t offset);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
|
||||
// Global variables
|
||||
|
||||
extern int lockStatus;
|
||||
extern char lastClientIP[INET_ADDRSTRLEN];
|
||||
extern char thisClientIP[INET_ADDRSTRLEN];
|
||||
@ -1060,7 +1059,7 @@ int set_dac(int file_des) {
|
||||
if((ind == HV_POT) || (ind == HV_NEW)) {
|
||||
retval[0] = setHighVoltage(val);
|
||||
#ifdef EIGERD
|
||||
if(retval[0] < 0){
|
||||
if ((retval[0] != SLAVE_HIGH_VOLTAGE_READ_VAL) && (retval[0] < 0)) {
|
||||
ret = FAIL;
|
||||
if(retval[0] == -1)
|
||||
sprintf(mess, "Setting high voltage failed.Bad value %d. The range is from 0 to 200 V.\n",val);
|
||||
@ -1243,15 +1242,6 @@ int write_register(int file_des) {
|
||||
int retval=-1;
|
||||
sprintf(mess,"write to register failed\n");
|
||||
|
||||
#ifdef EIGERD
|
||||
//to receive any arguments
|
||||
while (n > 0)
|
||||
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Function (Write Register) is not implemented for this detector\n");
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
#else
|
||||
|
||||
// receive arguments
|
||||
int arg[2]={-1,-1};
|
||||
n = receiveData(file_des,arg,sizeof(arg),INT32);
|
||||
@ -1283,7 +1273,6 @@ int write_register(int file_des) {
|
||||
#endif
|
||||
if (ret==OK && differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
#endif
|
||||
|
||||
// ret could be swapped during sendData
|
||||
ret1 = ret;
|
||||
@ -1311,15 +1300,6 @@ int read_register(int file_des) {
|
||||
int retval=-1;
|
||||
sprintf(mess,"read register failed\n");
|
||||
|
||||
#ifdef EIGERD
|
||||
//to receive any arguments
|
||||
while (n > 0)
|
||||
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Function (Read Register) is not implemented for this detector\n");
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
#else
|
||||
|
||||
// receive arguments
|
||||
int arg=0;
|
||||
n = receiveData(file_des,&arg,sizeof(arg),INT32);
|
||||
@ -1338,7 +1318,6 @@ int read_register(int file_des) {
|
||||
#endif
|
||||
if (ret==OK && differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
#endif
|
||||
|
||||
// ret could be swapped during sendData
|
||||
ret1 = ret;
|
||||
|
@ -129,8 +129,8 @@ public:
|
||||
Task(func2_t <string,slsDetector,networkParameter,string,string>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(t),m12(0),m13(0),m14(0),m15(0){};
|
||||
/* Return: void, Param: none */
|
||||
Task(func00_t <void,slsDetector>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(t),m13(0),m14(0),m15(0){};
|
||||
/* Return: int, Param: int,int,detectorSettings */
|
||||
Task(func3_t <int,slsDetector,int,int,detectorSettings,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(t),m14(0),m15(0){};
|
||||
/* Return: int, Param: int,int,detectorSettings,int */
|
||||
Task(func4_t <int,slsDetector,int,int,detectorSettings,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(t),m14(0),m15(0){};
|
||||
/* Return: dacs_t, Param: dacs_t, dacIndex, int, int */
|
||||
Task(func4_t <dacs_t,slsDetector,dacs_t,dacIndex,int,int,dacs_t>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(t),m15(0){};
|
||||
/* Return: dacs_t, Param: dacIndex, int */
|
||||
@ -185,8 +185,8 @@ private:
|
||||
func2_t <string,slsDetector,networkParameter,string,string>* m11;
|
||||
/* Return: void, Param: none */
|
||||
func00_t <void,slsDetector>* m12;
|
||||
/* Return: int, Param: int,int,detectorSettings */
|
||||
func3_t <int,slsDetector,int,int,detectorSettings,int>* m13;
|
||||
/* Return: int, Param: int,int,detectorSettings,int */
|
||||
func4_t <int,slsDetector,int,int,detectorSettings,int,int>* m13;
|
||||
/* Return: dacs_t, Param: dacs_t, dacIndex, int, int */
|
||||
func4_t <dacs_t,slsDetector,dacs_t,dacIndex,int,int,dacs_t>* m14;
|
||||
/* Return: dacs_t, Param: dacIndex, int */
|
||||
|
28
slsDetectorSoftware/updateGitVersion.sh
Executable file
28
slsDetectorSoftware/updateGitVersion.sh
Executable file
@ -0,0 +1,28 @@
|
||||
MAINDIR=slsDetectorsPackage
|
||||
SPECDIR=slsDetectorSoftware
|
||||
TMPFILE=slsDetector/gitInfoLibTmp.h
|
||||
INCLFILE=slsDetector/gitInfoLib.h
|
||||
WD=$PWD
|
||||
|
||||
#evaluate the variables
|
||||
EVALFILE=../evalVersionVariables.sh
|
||||
source $EVALFILE
|
||||
|
||||
#get modified date
|
||||
#RDATE1='git log --pretty=format:"%ci" -1'
|
||||
RDATE1="find . -not -path '*DetectorServer/*' -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | egrep -v 'gitInfo|build|.git|updateGitVersion' | head -n 1"
|
||||
RDATE=`eval $RDATE1`
|
||||
NEWDATE=$(sed "s/-//g" <<< $RDATE | awk '{print $1;}')
|
||||
NEWDATE=${NEWDATE/#/0x}
|
||||
|
||||
#get old date from INCLFILE
|
||||
OLDDATE=$(more $INCLFILE | grep '#define SVNDATE' | awk '{print $3}')
|
||||
|
||||
|
||||
#update INCLFILE if changes
|
||||
if [ "$OLDDATE" != "$NEWDATE" ]; then
|
||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
||||
cd ..
|
||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
||||
cd $WD
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user