mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
eiger receiver, receiving many packets at a time, with 16,8, 4 bitmode sort of working
This commit is contained in:
parent
b29879511b
commit
018b800117
@ -32,8 +32,9 @@ using namespace std;
|
||||
#define COULDNOT_ENABLE_COMPRESSION 0x0080000000000000ULL
|
||||
#define RECEIVER_DET_HOSTNAME_NOT_SET 0x0040000000000000ULL
|
||||
#define RECEIVER_DET_HOSTTYPE_NOT_SET 0x0020000000000000ULL
|
||||
#define DETECTOR_TEN_GIGA 0x0010000000000000ULL
|
||||
|
||||
|
||||
// 0xFFFFFFFF00000000ULL
|
||||
|
||||
#define COULD_NOT_CONFIGURE_MAC 0x0000000000000001ULL
|
||||
#define COULDNOT_SET_NETWORK_PARAMETER 0x0000000000000002ULL
|
||||
@ -47,7 +48,9 @@ using namespace std;
|
||||
#define RECEIVER_ACQ_PERIOD_NOT_SET 0x0000000000000200ULL
|
||||
#define RECEIVER_FRAME_NUM_NOT_SET 0x0000000000000400ULL
|
||||
#define RECEIVER_DYNAMIC_RANGE 0x0000000000000800ULL
|
||||
#define RECEIVER_TEN_GIGA 0x0000000000001000ULL
|
||||
|
||||
// 0x00000000FFFFFFFFULL
|
||||
/** @short class returning all error messages for error mask */
|
||||
class errorDefs {
|
||||
|
||||
|
@ -339,7 +339,8 @@ enum dacIndex {
|
||||
E_rxb_lb, /**< eiger */
|
||||
E_Vcp, /**< eiger */
|
||||
E_Vcn, /**< eiger */
|
||||
E_Vis /**< eiger */
|
||||
E_Vis, /**< eiger */
|
||||
IO_DELAY /**< eiger io delay */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -413,7 +414,10 @@ enum readOutFlags {
|
||||
PUMP_PROBE_MODE=0x8,/**<pump-probe mode */
|
||||
BACKGROUND_CORRECTIONS=0x1000, /**<background corrections */
|
||||
TOT_MODE=0x2000,/**<pump-probe mode */
|
||||
CONTINOUS_RO=0x4000/**<pump-probe mode */
|
||||
CONTINOUS_RO=0x4000,/**<pump-probe mode */
|
||||
PARALLEL=0x10,/** <eiger parallel mode */
|
||||
NONPARALLEL=0x20,/** <eiger serial mode */
|
||||
SAFE=0x40/** <eiger safe mode */
|
||||
};
|
||||
/**
|
||||
trimming modes
|
||||
|
@ -87,7 +87,10 @@ enum {
|
||||
F_SET_SYNCHRONIZATION_MODE, /**< sets master/slave synchronization mode for multidetector structures */
|
||||
F_READ_COUNTER_BLOCK, /**< reads the counter block memory for gotthard */
|
||||
F_RESET_COUNTER_BLOCK, /**< resets the counter block memory for gotthard */
|
||||
F_CALIBRATE_PEDESTAL /**< starts acquistion, calibrates pedestal and write back to fpga */
|
||||
F_CALIBRATE_PEDESTAL, /**< starts acquistion, calibrates pedestal and write back to fpga */
|
||||
|
||||
F_ENABLE_TEN_GIGA /**< enable 10Gbe */
|
||||
|
||||
|
||||
/* Always append functions hereafter!!! */
|
||||
|
||||
|
@ -22,6 +22,7 @@ int eiger_back_ret_val=0;
|
||||
|
||||
|
||||
int bit_mode=0;
|
||||
int ten_giga=0;
|
||||
|
||||
int EigerBackInit(){
|
||||
static int passed = 0;
|
||||
@ -110,13 +111,13 @@ int EigerSetupTableEntryLeft(int ipad, long long int macad, long long int detect
|
||||
int dst_port = udpport;
|
||||
sprintf(src_ip,"%d.%d.%d.%d",(detipad>>24)&0xff,(detipad>>16)&0xff,(detipad>>8)&0xff,(detipad)&0xff);
|
||||
sprintf(dst_ip,"%d.%d.%d.%d",(ipad>>24)&0xff,(ipad>>16)&0xff,(ipad>>8)&0xff,(ipad)&0xff);
|
||||
sprintf(src_mac,"%x:%x:%x:%x:%x:%x",(unsigned int)((detectormacadd>>40)&0xFF),
|
||||
sprintf(src_mac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((detectormacadd>>40)&0xFF),
|
||||
(unsigned int)((detectormacadd>>32)&0xFF),
|
||||
(unsigned int)((detectormacadd>>24)&0xFF),
|
||||
(unsigned int)((detectormacadd>>16)&0xFF),
|
||||
(unsigned int)((detectormacadd>>8)&0xFF),
|
||||
(unsigned int)((detectormacadd>>0)&0xFF));
|
||||
sprintf(dst_mac,"%x:%x:%x:%x:%x:%x",(unsigned int)((macad>>40)&0xFF),
|
||||
sprintf(dst_mac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((macad>>40)&0xFF),
|
||||
(unsigned int)((macad>>32)&0xFF),
|
||||
(unsigned int)((macad>>24)&0xFF),
|
||||
(unsigned int)((macad>>16)&0xFF),
|
||||
@ -129,7 +130,7 @@ int EigerSetupTableEntryLeft(int ipad, long long int macad, long long int detect
|
||||
if(((macad>>40)&0xFF)<9)
|
||||
sprintf(dst_mac,"0%s",macad);
|
||||
*/
|
||||
strcpy(src_mac,"00:aa:bb:cc:dd:ee");
|
||||
//strcpy(src_mac,"00:aa:bb:cc:dd:ee");
|
||||
printf("Seting up Table Entry Left:\n");
|
||||
printf("src_port:%d\n",src_port);
|
||||
printf("dst_port:%d\n",dst_port);
|
||||
@ -141,7 +142,7 @@ int EigerSetupTableEntryLeft(int ipad, long long int macad, long long int detect
|
||||
|
||||
|
||||
eiger_back_ret_val=0;
|
||||
eiger_back_message_length = sprintf(eiger_back_message,"setuptableentry %d %d %d %s %s %d %s %s %d",34,0,0,src_mac,src_ip,src_port,dst_mac,dst_ip,dst_port);
|
||||
eiger_back_message_length = sprintf(eiger_back_message,"setuptableentry %d %d %d %s %s %d %s %s %d",34,ten_giga,0,src_mac,src_ip,src_port,dst_mac,dst_ip,dst_port);
|
||||
return EigerBackSendCMD();
|
||||
}
|
||||
|
||||
@ -153,20 +154,20 @@ int EigerSetupTableEntryRight(int ipad, long long int macad, long long int detec
|
||||
int dst_port = udpport+1;
|
||||
sprintf(src_ip,"%d.%d.%d.%d",(detipad>>24)&0xff,(detipad>>16)&0xff,(detipad>>8)&0xff,(detipad)&0xff);
|
||||
sprintf(dst_ip,"%d.%d.%d.%d",(ipad>>24)&0xff,(ipad>>16)&0xff,(ipad>>8)&0xff,(ipad)&0xff);
|
||||
sprintf(src_mac,"%x:%x:%x:%x:%x:%x",(unsigned int)((detectormacadd>>40)&0xFF),
|
||||
sprintf(src_mac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((detectormacadd>>40)&0xFF),
|
||||
(unsigned int)((detectormacadd>>32)&0xFF),
|
||||
(unsigned int)((detectormacadd>>24)&0xFF),
|
||||
(unsigned int)((detectormacadd>>16)&0xFF),
|
||||
(unsigned int)((detectormacadd>>8)&0xFF),
|
||||
(unsigned int)((detectormacadd>>0)&0xFF));
|
||||
sprintf(dst_mac,"%x:%x:%x:%x:%x:%x",(unsigned int)((macad>>40)&0xFF),
|
||||
sprintf(dst_mac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((macad>>40)&0xFF),
|
||||
(unsigned int)((macad>>32)&0xFF),
|
||||
(unsigned int)((macad>>24)&0xFF),
|
||||
(unsigned int)((macad>>16)&0xFF),
|
||||
(unsigned int)((macad>>8)&0xFF),
|
||||
(unsigned int)((macad>>0)&0xFF));
|
||||
|
||||
strcpy(src_mac,"00:aa:bb:cc:dd:ee");
|
||||
//strcpy(src_mac,"00:aa:bb:cc:dd:ee");
|
||||
printf("Seting up Table Entry Right:\n");
|
||||
printf("src_port:%d\n",src_port);
|
||||
printf("dst_port:%d\n",dst_port);
|
||||
@ -176,7 +177,7 @@ int EigerSetupTableEntryRight(int ipad, long long int macad, long long int detec
|
||||
printf("dst_mac:%s\n\n",dst_mac);
|
||||
|
||||
eiger_back_ret_val=0;
|
||||
eiger_back_message_length = sprintf(eiger_back_message,"setuptableentry %d %d %d %s %s %d %s %s %d",34,0,32,src_mac,src_ip,src_port,dst_mac,dst_ip,dst_port);
|
||||
eiger_back_message_length = sprintf(eiger_back_message,"setuptableentry %d %d %d %s %s %d %s %s %d",34,ten_giga,32,src_mac,src_ip,src_port,dst_mac,dst_ip,dst_port);
|
||||
return EigerBackSendCMD();
|
||||
}
|
||||
|
||||
@ -197,12 +198,22 @@ int SetDestinationParameters(int i){
|
||||
|
||||
int SetLeftDestinationParameters(int i){
|
||||
eiger_back_ret_val=0;
|
||||
eiger_back_message_length = sprintf(eiger_back_message,"setdstparameters %d %d %d",0,1,i);
|
||||
eiger_back_message_length = sprintf(eiger_back_message,"setdstparameters %d %d %d",ten_giga,1,i);
|
||||
return EigerBackSendCMD();
|
||||
}
|
||||
|
||||
int SetRightDestinationParameters(int i){
|
||||
eiger_back_ret_val=0;
|
||||
eiger_back_message_length = sprintf(eiger_back_message,"setdstparameters %d %d %d",0,32,i);
|
||||
eiger_back_message_length = sprintf(eiger_back_message,"setdstparameters %d %d %d",ten_giga,32,i);
|
||||
return EigerBackSendCMD();
|
||||
}
|
||||
|
||||
|
||||
void SetTenGigbaBitEthernet(int val){
|
||||
ten_giga = val;
|
||||
}
|
||||
|
||||
|
||||
int GetTenGigbaBitEthernet(){
|
||||
return ten_giga;
|
||||
}
|
||||
|
@ -18,26 +18,38 @@ char eiger_message[1024];
|
||||
int eiger_message_length = 0;
|
||||
int eiger_ret_val=0;
|
||||
|
||||
int eiger_nexposures = 0;
|
||||
float eiger_exposuretime = 0;
|
||||
float eiger_exposureperiod = 0;
|
||||
int eiger_ncycles = 0;
|
||||
int eiger_ngates = 0;
|
||||
int eiger_getphotonenergy = 0;
|
||||
int eiger_dynamicrange = 0;
|
||||
int eiger_readoutspeed = 0;
|
||||
int eiger_readoutmode = 0;
|
||||
int eiger_highvoltage = 0;
|
||||
int eiger_iodelay = 0;
|
||||
int eiger_triggermode = 0;
|
||||
|
||||
const unsigned int ndacs = 16;
|
||||
const char* dac_names[16] = {"SvP","Vtr","Vrf","Vrs","SvN","Vtgstv","Vcmp_ll","Vcmp_lr","cal","Vcmp_rl","rxb_rb","rxb_lb","Vcmp_rr","Vcp","Vcn","Vis"};
|
||||
|
||||
|
||||
|
||||
|
||||
int eiger_nexposures = 1;
|
||||
int EigerGetNumberOfExposures(){return eiger_nexposures;}
|
||||
float eiger_exposuretime = 1;
|
||||
float EigerGetExposureTime(){return eiger_exposuretime;}
|
||||
float eiger_exposureperiod = 1;
|
||||
float EigerGetExposurePeriod(){return eiger_exposureperiod;}
|
||||
unsigned int eigerdynamicrange = 16;
|
||||
unsigned int EigerGetDynamicRange(){return eigerdynamicrange;}
|
||||
int eigergetphotonenergy = 8000;
|
||||
int EigerGetPhotonEnergy(){return eigergetphotonenergy;}
|
||||
/* for later */
|
||||
int eigernumberofexposureseries = 1;
|
||||
int EigerGetNumberOfExposureSeries(){return eigernumberofexposureseries;}
|
||||
int EigerSetNumberOfExposureSeries(int i){eigernumberofexposureseries = i;return 1;}
|
||||
int EigerGetNumberOfCycles(){return eiger_ncycles;}
|
||||
/*int EigerGetNumberOfGates(){return eiger_ngates;}*/
|
||||
unsigned int EigerGetDynamicRange(){return eiger_dynamicrange;}
|
||||
int EigerGetPhotonEnergy(){return eiger_getphotonenergy;}
|
||||
int EigerGetReadoutSpeed(){return eiger_readoutspeed;}
|
||||
int EigerGetReadoutMode(){return eiger_readoutmode;}
|
||||
int EigerGetHighVoltage(){return eiger_highvoltage;}
|
||||
int EigerGetIODelay(){return eiger_iodelay;}
|
||||
int EigerGetTriggerMode(){return eiger_triggermode;}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -116,13 +128,13 @@ const char* EigerGetDACName(int i){
|
||||
|
||||
int EigerSetDAC(const char* iname,int v){
|
||||
eiger_ret_val=0;
|
||||
eiger_message_length = sprintf(eiger_message,"setdacvalue %s %d",iname,v);
|
||||
eiger_message_length = sprintf(eiger_message,"setdacvoltage %s %d",iname,v); //setdacvoltage
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
int EigerGetDAC(const char* iname){
|
||||
eiger_ret_val=1;
|
||||
eiger_message_length = sprintf(eiger_message,"getdacvalue %s",iname);
|
||||
eiger_message_length = sprintf(eiger_message,"getdacvoltage %s",iname);//getdacvoltage
|
||||
if(!EigerSendCMD()) return -1;
|
||||
return eiger_ret_val;
|
||||
}
|
||||
@ -134,15 +146,6 @@ int EigerSetNumberOfExposures(unsigned int n){
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
/*
|
||||
int EigerGetNumberOfExposures(unsigned int n){
|
||||
eiger_ret_val=1;
|
||||
eiger_message_length = sprintf(eiger_message,"getnumberofexposures %s",iname);
|
||||
if(!EigerSendCMD()) return -1;
|
||||
return eiger_ret_val;
|
||||
}
|
||||
*/
|
||||
|
||||
int EigerSetExposureTime(float v){
|
||||
eiger_exposuretime = v;
|
||||
eiger_ret_val=0;
|
||||
@ -150,14 +153,6 @@ int EigerSetExposureTime(float v){
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
/*
|
||||
int EigerGetExposureTime(float v){
|
||||
eiger_ret_val=1;
|
||||
eiger_message_length = sprintf(eiger_message,"getexposuretime");
|
||||
if(!EigerSendCMD()) return 0;
|
||||
return eiger_ret_val;
|
||||
}
|
||||
*/
|
||||
|
||||
int EigerSetExposurePeriod(float v){
|
||||
eiger_exposureperiod = v;
|
||||
@ -166,52 +161,70 @@ int EigerSetExposurePeriod(float v){
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
int EigerSetNumberOfCycles(unsigned int n){
|
||||
eiger_ncycles = n;
|
||||
eiger_ret_val=0;
|
||||
eiger_message_length = sprintf(eiger_message,"setnumberofexposures %u",n);
|
||||
return EigerSendCMD();
|
||||
}
|
||||
/*
|
||||
int EigerGetExposurePeriod(float v){
|
||||
eiger_ret_val=1;
|
||||
eiger_message_length = sprintf(eiger_message,"getexposuretime");
|
||||
if(!EigerSendCMD()) return 0;
|
||||
return eiger_ret_val;
|
||||
int EigerSetNumberOfGates(unsigned int n){
|
||||
eiger_ngates = n;
|
||||
eiger_ret_val=0;
|
||||
eiger_message_length = sprintf(eiger_message,"setnumberofexposures %u",n);
|
||||
return EigerSendCMD();
|
||||
}
|
||||
*/
|
||||
|
||||
int EigerSetDynamicRange(unsigned int i){
|
||||
eigerdynamicrange = i;
|
||||
eiger_dynamicrange = i;
|
||||
eiger_ret_val=0;
|
||||
eiger_message_length = sprintf(eiger_message,"setbitmode %u",i);
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
/*
|
||||
int EigerGetDynamicRange(){
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
int EigerSetPhotonEnergy(int in_eV){
|
||||
eigergetphotonenergy = in_eV;
|
||||
eiger_getphotonenergy = in_eV;
|
||||
eiger_ret_val=0;
|
||||
eiger_message_length = sprintf(eiger_message,"setphotonenergy %d",in_eV);
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
/*
|
||||
int EigerGetPhotonEnergy(int in_eV){
|
||||
eiger_ret_val=1;
|
||||
eiger_message_length = sprintf(eiger_message,"the %s",iname);
|
||||
if(!EigerSendCMD()) return -1;
|
||||
return eiger_ret_val;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
int EigerSetGainMode(int i){
|
||||
int EigerSetReadoutSpeed(int speed){
|
||||
eiger_readoutspeed = speed;
|
||||
eiger_ret_val=0;
|
||||
eiger_message_length = sprintf(eiger_message,"setphotonenergy %f",v);
|
||||
eiger_message_length = sprintf(eiger_message,"setreadoutspeed %d",speed);
|
||||
return EigerSendCMD();
|
||||
}
|
||||
get function too....
|
||||
*/
|
||||
|
||||
int EigerSetReadoutMode(int mode){
|
||||
eiger_readoutmode = mode;
|
||||
eiger_ret_val=0;
|
||||
eiger_message_length = sprintf(eiger_message,"setreadoutmode %d",mode);
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
int EigerSetHighVoltage(int hv){
|
||||
eiger_highvoltage = hv;
|
||||
eiger_ret_val=0;
|
||||
eiger_message_length = sprintf(eiger_message,"sethighvoltage %d",hv);
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
int EigerSetIODelay(int io){
|
||||
eiger_iodelay = io;
|
||||
eiger_ret_val=0;
|
||||
eiger_message_length = sprintf(eiger_message,"setinputdelays %d",io);
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
int EigerSetTriggerMode(int m){
|
||||
eiger_triggermode = m;
|
||||
eiger_ret_val=0;
|
||||
eiger_message_length = sprintf(eiger_message,"settriggermode %d",m);
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
|
||||
int EigerStartAcquisition(){
|
||||
eiger_ret_val=0;
|
||||
|
@ -26,10 +26,11 @@ using namespace std;
|
||||
enum cmd_string {evNotFound,
|
||||
evReinitialize,evReset,
|
||||
|
||||
// evSetInputDelays,
|
||||
evSetInputDelays,
|
||||
evSetDACValue,evGetDACValue,evSetDACVoltage,evGetDACVoltage,evSetHighVoltage,//evGetHighVoltage,
|
||||
|
||||
// evSetTrimBits,evLoadTrimBitFile,
|
||||
evSetTrimBits,
|
||||
//evLoadTrimBitFile,
|
||||
|
||||
evSetBitMode,
|
||||
evSetPhotonEnergy,
|
||||
@ -41,7 +42,8 @@ enum cmd_string {evNotFound,
|
||||
// evNotFound1,evNotFound2,evNotFound3,
|
||||
|
||||
evSetNumberOfExposures,evSetExposureTime,evSetExposurePeriod,
|
||||
// evSetTriggerPolarityToPositive,evSetTriggerPolarityToNegative,evSetTriggerMode,
|
||||
// evSetTriggerPolarityToPositive,evSetTriggerPolarityToNegative,
|
||||
evSetTriggerMode,
|
||||
// evEnableExternalGatingWhenSignalsPositive,evEnableExternalGatingWhenSignalsNegative,evDisableExternalGating,
|
||||
evStartAcquisition,evStopAcquisition,evIsDaqStillRunning};
|
||||
// evWaitUntilDaqFinished,evExitServer
|
||||
@ -54,14 +56,14 @@ void init(){
|
||||
enum_map["reinitialize"] = evReinitialize;
|
||||
enum_map["reset"] = evReset;
|
||||
|
||||
// enum_map["setinputdelays"] = evSetInputDelays;
|
||||
enum_map["setinputdelays"] = evSetInputDelays;
|
||||
enum_map["setdacvalue"] = evSetDACValue;
|
||||
enum_map["getdacvalue"] = evGetDACValue;
|
||||
enum_map["setdacvoltage"] = evSetDACVoltage;
|
||||
enum_map["getdacvoltage"] = evGetDACVoltage;
|
||||
enum_map["sethighvoltage"] = evSetHighVoltage;
|
||||
|
||||
// enum_map["settrimbits"] = evSetTrimBits;
|
||||
enum_map["settrimbits"] = evSetTrimBits;
|
||||
// enum_map["loadtrimbitfile"] = evLoadTrimBitFile;
|
||||
|
||||
enum_map["setbitmode"] = evSetBitMode;
|
||||
@ -82,8 +84,9 @@ void init(){
|
||||
/*
|
||||
enum_map["settriggerpolaritytopositive"] = evSetTriggerPolarityToPositive;
|
||||
enum_map["settriggerpolaritytonegative"] = evSetTriggerPolarityToNegative;
|
||||
*/
|
||||
enum_map["settriggermode"] = evSetTriggerMode;
|
||||
|
||||
/*
|
||||
enum_map["enableexternalgatingwhensignalspositive"] = evEnableExternalGatingWhenSignalsPositive;
|
||||
enum_map["enableexternalgatingwhensignalsnegative"] = evEnableExternalGatingWhenSignalsNegative;
|
||||
enum_map["disableexternalgating"] = evDisableExternalGating;
|
||||
@ -185,7 +188,21 @@ int main(int argc, char* argv[]){
|
||||
break;
|
||||
|
||||
|
||||
// case evSetInputDelays :
|
||||
|
||||
case evSetInputDelays :
|
||||
tmp_str[0] = GetNextString(data);
|
||||
n[0] = atoi(tmp_str[0].data());
|
||||
|
||||
if(tmp_str[0].length()>0&&feb_controler->SetIDelays(0,n[0])){
|
||||
return_message.append("\tExecuted: SetInputDelays "); AddNumber(return_message,n[0]); return_message.append("\n");
|
||||
ret_val = 0;
|
||||
}else{
|
||||
return_message.append("\tError executing: SetInputDelays <delay>\n");
|
||||
ret_val = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case evSetDACValue :
|
||||
tmp_str[0] = GetNextString(data);
|
||||
@ -252,7 +269,17 @@ int main(int argc, char* argv[]){
|
||||
}
|
||||
break;
|
||||
|
||||
// case evSetTrimBits :
|
||||
case evSetTrimBits :
|
||||
/*if(tmp_str[0].length()>0&&feb_controler->SetDynamicRange(n[0])){*/
|
||||
feb_controler->SetTrimbits(0,(unsigned char*)data);
|
||||
return_message.append("\tExecuted: SetTrimBits "); AddNumber(return_message,n[0]); return_message.append("\n");
|
||||
ret_val = 0;
|
||||
/*}else{
|
||||
return_message.append("\tError executing: SetTrimBits \n");
|
||||
ret_val = 1;
|
||||
} */
|
||||
break;
|
||||
|
||||
// case evLoadTrimBitFile :
|
||||
|
||||
case evSetBitMode :
|
||||
@ -347,7 +374,17 @@ int main(int argc, char* argv[]){
|
||||
break;
|
||||
// case evSetTriggerPolarityToPositive :
|
||||
// case evSetTriggerPolarityToNegative :
|
||||
// case evSetTriggerMode :
|
||||
case evSetTriggerMode :
|
||||
tmp_str[0] = GetNextString(data);
|
||||
n[0] = atoi(tmp_str[0].data());
|
||||
if(tmp_str[0].length()>0&&feb_controler->SetTriggerMode(n[0])){
|
||||
return_message.append("\tExecuted: SetTriggerMode "); AddNumber(return_message,n[0]); return_message.append("\n");
|
||||
ret_val = 0;
|
||||
}else{
|
||||
return_message.append("\tError executing: SetTriggerMode <n>\n");
|
||||
ret_val = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
// case evEnableExternalGatingWhenSignalsPositive :
|
||||
// case evEnableExternalGatingWhenSignalsNegative :
|
||||
|
Binary file not shown.
Binary file not shown.
@ -12,17 +12,83 @@
|
||||
#include "EigerBackEndFunctions.c"
|
||||
|
||||
|
||||
enum detectorSettings thisSettings = STANDARD;
|
||||
enum detectorSettings thisSettings;
|
||||
//static const string dacNames[16] = {"Svp","Svn","Vtr","Vrf","Vrs","Vtgstv","Vcmp_ll","Vcmp_lr","Cal","Vcmp_rl","Vcmp_rr","Rxb_rb","Rxb_lb","Vcp","Vcn","Vis"};
|
||||
|
||||
sls_detector_module *detectorModules=NULL;
|
||||
int *detectorChips=NULL;
|
||||
int *detectorChans=NULL;
|
||||
dacs_t *detectorDacs=NULL;
|
||||
dacs_t *detectorAdcs=NULL;
|
||||
|
||||
|
||||
|
||||
int initDetector(){
|
||||
int imod,i,n;
|
||||
n = getNModBoard(1);
|
||||
|
||||
printf("This is the EIGER Server\n");
|
||||
|
||||
//#ifdef VERBOSE
|
||||
printf("Board is for %d half modules\n",n);
|
||||
//#endif
|
||||
|
||||
|
||||
detectorModules=malloc(n*sizeof(sls_detector_module));
|
||||
detectorChips=malloc(n*NCHIP*sizeof(int));
|
||||
|
||||
detectorChans=malloc(n*NCHIP*NCHAN*sizeof(int));
|
||||
detectorDacs=malloc(n*NDAC*sizeof(dacs_t));
|
||||
detectorAdcs=malloc(n*NADC*sizeof(dacs_t));
|
||||
#ifdef VERBOSE
|
||||
printf("modules from 0x%x to 0x%x\n",detectorModules, detectorModules+n);
|
||||
printf("chips from 0x%x to 0x%x\n",detectorChips, detectorChips+n*NCHIP);
|
||||
printf("chans from 0x%x to 0x%x\n",detectorChans, detectorChans+n*NCHIP*NCHAN);
|
||||
printf("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs+n*NDAC);
|
||||
printf("adcs from 0x%x to 0x%x\n",detectorAdcs, detectorAdcs+n*NADC);
|
||||
#endif
|
||||
for (imod=0; imod<n; imod++) {
|
||||
(detectorModules+imod)->dacs=detectorDacs+imod*NDAC;
|
||||
(detectorModules+imod)->adcs=detectorAdcs+imod*NADC;
|
||||
(detectorModules+imod)->chipregs=detectorChips+imod*NCHIP;
|
||||
(detectorModules+imod)->chanregs=detectorChans+imod*NCHIP*NCHAN;
|
||||
(detectorModules+imod)->ndac=NDAC;
|
||||
(detectorModules+imod)->nadc=NADC;
|
||||
(detectorModules+imod)->nchip=NCHIP;
|
||||
(detectorModules+imod)->nchan=NCHIP*NCHAN;
|
||||
(detectorModules+imod)->module=imod;
|
||||
(detectorModules+imod)->gain=0;
|
||||
(detectorModules+imod)->offset=0;
|
||||
(detectorModules+imod)->reg=0;
|
||||
/* initialize registers, dacs, retrieve sn, adc values etc */
|
||||
}
|
||||
thisSettings = STANDARD;/**UNITIALIZED*/
|
||||
/*sChan=noneSelected;
|
||||
sChip=noneSelected;
|
||||
sMod=noneSelected;
|
||||
sDac=noneSelected;
|
||||
sAdc=noneSelected;
|
||||
*/
|
||||
|
||||
//get dac values
|
||||
for(i=0;i<(detectorModules)->ndac;i++)
|
||||
(detectorModules)->dacs[i] = setDAC((enum detDacIndex)i,-1,(detectorModules)->module);
|
||||
|
||||
/* initialize dynamic range etc. */
|
||||
|
||||
|
||||
//set number of frames to 1
|
||||
setTimer(FRAME_NUMBER,1);
|
||||
setTimer(ACQUISITION_TIME,1E9);
|
||||
setTimer(ACQUISITION_TIME,1E9);
|
||||
return 1;
|
||||
setDynamicRange(16);
|
||||
setThresholdEnergy(8000,0);
|
||||
setReadOutFlags(PARALLEL);
|
||||
setSpeed(0,1);//clk_devider,half speed
|
||||
setHighVolage(150,0);
|
||||
setIODelay(675,0);
|
||||
setTiming(AUTO_TIMING);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -164,6 +230,14 @@ int setDAC(enum detDacIndex ind, int val, int imod){
|
||||
}
|
||||
|
||||
|
||||
int setHighVolage(int val, int imod){
|
||||
if(val!=-1){
|
||||
printf(" Setting High Voltage: %d\n",val);
|
||||
EigerSetHighVoltage(val);
|
||||
}
|
||||
return EigerGetHighVoltage();
|
||||
}
|
||||
|
||||
|
||||
int getADC(enum detDacIndex ind, int imod){
|
||||
//get adc value
|
||||
@ -171,42 +245,67 @@ int getADC(enum detDacIndex ind, int imod){
|
||||
}
|
||||
|
||||
|
||||
int setIODelay(int val, int imod){
|
||||
if(val!=-1){
|
||||
printf(" Setting IO Delay: %d\n",val);
|
||||
EigerSetIODelay(val);
|
||||
}
|
||||
return EigerGetIODelay();
|
||||
}
|
||||
|
||||
|
||||
int enableTenGigabitEthernet(int val){
|
||||
if(val!=-1){
|
||||
if(val>0)
|
||||
SetTenGigbaBitEthernet(1);
|
||||
else
|
||||
SetTenGigbaBitEthernet(0);
|
||||
SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
||||
//configuremac called from client
|
||||
}
|
||||
return GetTenGigbaBitEthernet();
|
||||
}
|
||||
|
||||
|
||||
int setModule(sls_detector_module myMod){
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
printf("Setting module with settings %d\n",myMod.reg);
|
||||
#endif
|
||||
|
||||
int i;
|
||||
for(i=0;i<myMod.ndac;i++)
|
||||
setDAC((enum detDacIndex)i,myMod.dacs[i],myMod.module);
|
||||
|
||||
thisSettings = (enum detectorSettings)myMod.reg;
|
||||
|
||||
thisSettings = (enum detectorSettings)myMod.reg;
|
||||
thisSettings = 0;
|
||||
/** set trimbits*/
|
||||
if (detectorModules)
|
||||
copyModule(detectorModules,&myMod);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getModule(sls_detector_module *myMod){
|
||||
/*
|
||||
int i;
|
||||
for(i=0;i<myMod->ndac;i++)
|
||||
myMod->dacs[i]= dacvalues[i];
|
||||
|
||||
//template getModulebyNumber() from mcb_funcs.c
|
||||
*/
|
||||
int getModule(sls_detector_module *myMod){
|
||||
if (detectorModules)
|
||||
copyModule(myMod,detectorModules);/*copyModule(myMod,detectorModules+iMod);*/
|
||||
else
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int getThresholdEnergy(int imod){
|
||||
printf("Threshold energy: %d\n",EigerGetPhotonEnergy());
|
||||
printf(" Getting Threshold energy\n");
|
||||
return EigerGetPhotonEnergy();
|
||||
}
|
||||
|
||||
|
||||
int setThresholdEnergy(int thr, int imod){
|
||||
printf("Setting threshold energy:%d\n",thr);
|
||||
printf(" Setting threshold energy:%d\n",thr);
|
||||
EigerSetPhotonEnergy(thr);
|
||||
return EigerGetPhotonEnergy();
|
||||
}
|
||||
@ -214,12 +313,15 @@ int setThresholdEnergy(int thr, int imod){
|
||||
|
||||
|
||||
enum detectorSettings setSettings(enum detectorSettings sett, int imod){
|
||||
|
||||
if(sett != GET_SETTINGS)
|
||||
printf("trying to set settings!\n");
|
||||
thisSettings = sett;
|
||||
return thisSettings;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int startStateMachine(){
|
||||
printf("Going to start acquisition\n");
|
||||
EigerStartAcquisition();
|
||||
@ -237,35 +339,38 @@ int stopStateMachine(){
|
||||
|
||||
int startReadOut(){
|
||||
RequestImages();
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
enum runStatus getRunStatus(){
|
||||
int i = EigerRunStatus();
|
||||
printf("Status:%d ",i);
|
||||
if(i== 0){
|
||||
printf(" returning %d\n",IDLE);
|
||||
printf("IDLE\n");
|
||||
return IDLE;
|
||||
}else{
|
||||
printf(" returning %d\n",RUNNING);
|
||||
printf("RUNNING\n");
|
||||
return RUNNING;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
char *readFrame(int *ret, char *mess){
|
||||
int i = EigerRunStatus();
|
||||
printf("status:%d\n",i);
|
||||
while(i){
|
||||
i = EigerRunStatus();
|
||||
printf("status:%d\n",i);
|
||||
usleep(1000);/* should be watiing in server*/
|
||||
}*ret = (int)FINISHED;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val){
|
||||
|
||||
switch(ind){
|
||||
@ -273,7 +378,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
||||
if(val >= 0){
|
||||
printf(" Setting number of frames: %d\n",(unsigned int)val);
|
||||
EigerSetNumberOfExposures((unsigned int)val);
|
||||
SetDestinationParameters(val);
|
||||
SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
||||
}return EigerGetNumberOfExposures();
|
||||
case ACQUISITION_TIME:
|
||||
if(val >= 0){
|
||||
@ -289,10 +394,12 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
||||
if(val >= 0)
|
||||
EigerSetNumberOfExposures((unsigned int)val);
|
||||
return EigerGetNumberOfExposures();
|
||||
|
||||
case GATES_NUMBER:
|
||||
if(val >= 0)
|
||||
EigerSetNumberOfExposures((unsigned int)val);
|
||||
return EigerGetNumberOfExposures();
|
||||
EigerSetNumberOfGates((unsigned int)val);
|
||||
return EigerGetNumberOfGates();
|
||||
|
||||
case PROBES_NUMBER:
|
||||
if(val >= 0)
|
||||
EigerSetNumberOfExposures((unsigned int)val);
|
||||
@ -300,8 +407,9 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
||||
case CYCLES_NUMBER:
|
||||
if(val >= 0){
|
||||
printf(" Setting number of triggers: %d\n",(unsigned int)val);
|
||||
EigerSetNumberOfExposureSeries((unsigned int)val);
|
||||
}return EigerGetNumberOfExposureSeries();
|
||||
EigerSetNumberOfCycles((unsigned int)val);
|
||||
SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
||||
}return EigerGetNumberOfCycles();
|
||||
default:
|
||||
printf("unknown timer index: %d\n",ind);
|
||||
break;
|
||||
@ -311,20 +419,15 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int64_t getTimeLeft(enum timerIndex ind){
|
||||
//template getDelay() from firmware_funcs.c
|
||||
//reads from reg
|
||||
//FRAME_NUMBER
|
||||
//ACQUISITION_TIME
|
||||
//FRAME_PERIOD
|
||||
//DELAY_AFTER_TRIGGER
|
||||
//GATES_NUMBER
|
||||
//PROBES_NUMBER
|
||||
//CYCLES_NUMBER
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int setDynamicRange(int dr){
|
||||
int r;
|
||||
if(dr > 0){
|
||||
@ -336,14 +439,32 @@ int setDynamicRange(int dr){
|
||||
r= EigerGetDynamicRange();
|
||||
if(r != EigerGetBitMode())
|
||||
EigerSetBitMode(r);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum readOutFlags setReadOutFlags(enum readOutFlags val){
|
||||
//template setStoreInRAM from firmware_funcs.c
|
||||
return GET_READOUT_FLAGS;
|
||||
int ret;
|
||||
if(val!=GET_READOUT_FLAGS){
|
||||
switch(val){
|
||||
case PARALLEL: val=0; break;
|
||||
case NONPARALLEL: val=1; break;
|
||||
case SAFE: val=2; break;
|
||||
default: val=0; break;
|
||||
}
|
||||
printf(" Setting Read out Flag: %d\n",val);
|
||||
EigerSetReadoutMode(val);
|
||||
}
|
||||
switch(EigerGetReadoutMode()){
|
||||
case 0: ret=PARALLEL; break;
|
||||
case 1: ret=NONPARALLEL; break;
|
||||
case 2: ret=SAFE; break;
|
||||
default:ret=-1; break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -356,21 +477,16 @@ int setROI(int n, ROI arg[], int *retvalsize, int *ret){
|
||||
|
||||
|
||||
int setSpeed(enum speedVariable arg, int val){
|
||||
//template setClockDivider() from firmware_funcs.c
|
||||
//CLOCK_DIVIDER
|
||||
//WAIT_STATES
|
||||
//SET_SIGNAL_LENGTH
|
||||
//TOT_CLOCK_DIVIDER
|
||||
//TOT_DUTY_CYCLE
|
||||
|
||||
//returns eg getClockDivider from firmware_funcs.c
|
||||
return 0;
|
||||
if(val != -1){
|
||||
printf(" Setting Read out Speed: %d\n",val);
|
||||
EigerSetReadoutSpeed(val);
|
||||
}
|
||||
return EigerGetReadoutSpeed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int executeTrimming(enum trimMode mode, int par1, int par2, int imod){
|
||||
// template trim_with_noise from trimming_funcs.c
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -383,9 +499,87 @@ int configureMAC(int ipad, long long int macad, long long int detectormacadd, in
|
||||
|
||||
|
||||
int calculateDataBytes(){
|
||||
return 0;
|
||||
return setDynamicRange(-1)*16*1040;
|
||||
}
|
||||
|
||||
|
||||
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
|
||||
|
||||
int ichip, idac, ichan, iadc;
|
||||
int ret=OK;
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Copying module %x to module %x\n",srcMod,destMod);
|
||||
#endif
|
||||
|
||||
if (srcMod->module>=0) {
|
||||
#ifdef VERBOSE
|
||||
printf("Copying module number %d to module number %d\n",srcMod->module,destMod->module);
|
||||
#endif
|
||||
destMod->module=srcMod->module;
|
||||
}
|
||||
if (srcMod->serialnumber>=0){
|
||||
|
||||
destMod->serialnumber=srcMod->serialnumber;
|
||||
}
|
||||
if ((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)) {
|
||||
printf("Number of channels of source is larger than number of channels of destination\n");
|
||||
return FAIL;
|
||||
}
|
||||
if ((srcMod->ndac)>(destMod->ndac)) {
|
||||
printf("Number of dacs of source is larger than number of dacs of destination\n");
|
||||
return FAIL;
|
||||
}
|
||||
if ((srcMod->nadc)>(destMod->nadc)) {
|
||||
printf("Number of dacs of source is larger than number of dacs of destination\n");
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac);
|
||||
printf("ADCs: src %d, dest %d\n",srcMod->nadc,destMod->nadc);
|
||||
printf("Chips: src %d, dest %d\n",srcMod->nchip,destMod->nchip);
|
||||
printf("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan);
|
||||
|
||||
#endif
|
||||
destMod->ndac=srcMod->ndac;
|
||||
destMod->nadc=srcMod->nadc;
|
||||
destMod->nchip=srcMod->nchip;
|
||||
destMod->nchan=srcMod->nchan;
|
||||
if (srcMod->reg>=0)
|
||||
destMod->reg=srcMod->reg;
|
||||
#ifdef VERBOSE
|
||||
printf("Copying register %x (%x)\n",destMod->reg,srcMod->reg );
|
||||
#endif
|
||||
if (srcMod->gain>=0)
|
||||
destMod->gain=srcMod->gain;
|
||||
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);
|
||||
}
|
||||
for (idac=0; idac<(srcMod->ndac); idac++) {
|
||||
if (*((srcMod->dacs)+idac)>=0)
|
||||
*((destMod->dacs)+idac)=*((srcMod->dacs)+idac);
|
||||
}
|
||||
for (iadc=0; iadc<(srcMod->nadc); iadc++) {
|
||||
if (*((srcMod->adcs)+iadc)>=0)
|
||||
*((destMod->adcs)+iadc)=*((srcMod->adcs)+iadc);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int getTotalNumberOfChannels(){return getNumberOfChannelsPerModule();};//NCHIP*NCHAN*nModBoard;}
|
||||
int getTotalNumberOfChips(){return 4;};//NCHIP*nModBoard;}
|
||||
int getTotalNumberOfModules(){return 1;}//nModBoard;}
|
||||
@ -402,8 +596,6 @@ int getNumberOfADCsPerModule(){return 0;}//NADC;}
|
||||
|
||||
|
||||
enum externalSignalFlag getExtSignal(int signalindex){
|
||||
//template getExtSignal from firmware_funcs.c
|
||||
//return signals[signalindex];
|
||||
return GET_EXTERNAL_SIGNAL_FLAG;
|
||||
}
|
||||
|
||||
@ -412,48 +604,6 @@ enum externalSignalFlag getExtSignal(int signalindex){
|
||||
|
||||
|
||||
enum externalSignalFlag setExtSignal(int signalindex, enum externalSignalFlag flag){
|
||||
//template setExtSignal from firmware_funcs.c
|
||||
|
||||
//in short..sets signals array, checks if agrees with timing mode, writes to fpga reg, calls synchronization and then settiming
|
||||
/*
|
||||
if (signalindex>=0 && signalindex<4) {
|
||||
signals[signalindex]=flag;
|
||||
#ifdef VERBOSE
|
||||
printf("settings signal variable number %d to value %04x\n", signalindex, signals[signalindex]);
|
||||
#endif
|
||||
// if output signal, set it!
|
||||
switch (flag) {
|
||||
case GATE_IN_ACTIVE_HIGH:
|
||||
case GATE_IN_ACTIVE_LOW:
|
||||
if (timingMode==GATE_FIX_NUMBER || timingMode==GATE_WITH_START_TRIGGER)//timingMode = AUTO_TIMING by default and is set in setTiming()
|
||||
setFPGASignal(signalindex,flag); //not implemented here, checks if flag within limits and writes to fpga reg
|
||||
else
|
||||
setFPGASignal(signalindex,SIGNAL_OFF);
|
||||
break;
|
||||
case TRIGGER_IN_RISING_EDGE:
|
||||
case TRIGGER_IN_FALLING_EDGE:
|
||||
if (timingMode==TRIGGER_EXPOSURE || timingMode==GATE_WITH_START_TRIGGER)
|
||||
setFPGASignal(signalindex,flag);
|
||||
else
|
||||
setFPGASignal(signalindex,SIGNAL_OFF);
|
||||
break;
|
||||
case RO_TRIGGER_IN_RISING_EDGE:
|
||||
case RO_TRIGGER_IN_FALLING_EDGE:
|
||||
if (timingMode==TRIGGER_READOUT)
|
||||
setFPGASignal(signalindex,flag);
|
||||
else
|
||||
setFPGASignal(signalindex,SIGNAL_OFF);
|
||||
break;
|
||||
case MASTER_SLAVE_SYNCHRONIZATION:
|
||||
setSynchronization(syncMode);//syncmode = NO_SYNCHRONIZATION by default and set with this function
|
||||
break;
|
||||
default:
|
||||
setFPGASignal(signalindex,mode);
|
||||
}
|
||||
|
||||
setTiming(GET_EXTERNAL_COMMUNICATION_MODE);
|
||||
}
|
||||
*/
|
||||
return getExtSignal(signalindex);
|
||||
}
|
||||
|
||||
@ -463,254 +613,40 @@ enum externalSignalFlag setExtSignal(int signalindex, enum externalSignalFlag f
|
||||
|
||||
|
||||
enum externalCommunicationMode setTiming( enum externalCommunicationMode arg){
|
||||
|
||||
enum externalCommunicationMode ret=GET_EXTERNAL_COMMUNICATION_MODE;
|
||||
|
||||
ret = AUTO_TIMING;
|
||||
|
||||
if(arg != GET_EXTERNAL_COMMUNICATION_MODE){
|
||||
switch((int)arg){
|
||||
case AUTO_TIMING: ret = 0; break;
|
||||
case TRIGGER_EXPOSURE: ret = 2; break;
|
||||
case TRIGGER_READOUT: ret = 1; break;
|
||||
case GATE_FIX_NUMBER: ret = 3; break;
|
||||
}
|
||||
printf(" Setting Triggering Mode: %d\n",(int)ret);
|
||||
//EigerSetTriggerMode(ret);
|
||||
}
|
||||
ret=0;
|
||||
//ret = EigerGetTriggerMode();
|
||||
switch((int)ret){
|
||||
case 0: ret = AUTO_TIMING; break;
|
||||
case 2: ret = TRIGGER_EXPOSURE; break;
|
||||
case 1: ret = TRIGGER_READOUT; break;
|
||||
case 3: ret = GATE_FIX_NUMBER; break;
|
||||
default:
|
||||
printf("Unknown trigger mode found %d\n",ret);
|
||||
ret = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum masterFlags setMaster(enum masterFlags arg){
|
||||
//template setMaster from firmware_funcs.c
|
||||
/*
|
||||
int i;
|
||||
switch(f) {
|
||||
case NO_MASTER:
|
||||
// switch of gates or triggers
|
||||
masterMode=NO_MASTER;
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
setFPGASignal(i,SIGNAL_OFF);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IS_MASTER:
|
||||
// configure gate or trigger out
|
||||
masterMode=IS_MASTER;
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
switch (syncMode) {
|
||||
case NO_SYNCHRONIZATION:
|
||||
setFPGASignal(i,SIGNAL_OFF);
|
||||
break;
|
||||
case MASTER_GATES:
|
||||
setFPGASignal(i,GATE_OUT_ACTIVE_HIGH);
|
||||
break;
|
||||
case MASTER_TRIGGERS:
|
||||
setFPGASignal(i,TRIGGER_OUT_RISING_EDGE);
|
||||
break;
|
||||
case SLAVE_STARTS_WHEN_MASTER_STOPS:
|
||||
setFPGASignal(i,RO_TRIGGER_OUT_RISING_EDGE);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IS_SLAVE:
|
||||
// configure gate or trigger in
|
||||
masterMode=IS_SLAVE;
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
switch (syncMode) {
|
||||
case NO_SYNCHRONIZATION:
|
||||
setFPGASignal(i,SIGNAL_OFF);
|
||||
break;
|
||||
case MASTER_GATES:
|
||||
setFPGASignal(i,GATE_IN_ACTIVE_HIGH);
|
||||
break;
|
||||
case MASTER_TRIGGERS:
|
||||
setFPGASignal(i,TRIGGER_IN_RISING_EDGE);
|
||||
break;
|
||||
case SLAVE_STARTS_WHEN_MASTER_STOPS:
|
||||
setFPGASignal(i,TRIGGER_IN_RISING_EDGE);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//do nothing
|
||||
;
|
||||
}
|
||||
|
||||
switch(masterMode) {
|
||||
case NO_MASTER:
|
||||
return NO_MASTER;
|
||||
|
||||
|
||||
case IS_MASTER:
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
switch (syncMode) {
|
||||
case NO_SYNCHRONIZATION:
|
||||
return IS_MASTER;
|
||||
case MASTER_GATES:
|
||||
if (getFPGASignal(i)==GATE_OUT_ACTIVE_HIGH)
|
||||
return IS_MASTER;
|
||||
else
|
||||
return NO_MASTER;
|
||||
case MASTER_TRIGGERS:
|
||||
if (getFPGASignal(i)==TRIGGER_OUT_RISING_EDGE)
|
||||
return IS_MASTER;
|
||||
else
|
||||
return NO_MASTER;
|
||||
case SLAVE_STARTS_WHEN_MASTER_STOPS:
|
||||
if (getFPGASignal(i)==RO_TRIGGER_OUT_RISING_EDGE)
|
||||
return IS_MASTER;
|
||||
else
|
||||
return NO_MASTER;
|
||||
default:
|
||||
return NO_MASTER;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
case IS_SLAVE:
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
switch (syncMode) {
|
||||
case NO_SYNCHRONIZATION:
|
||||
return IS_SLAVE;
|
||||
case MASTER_GATES:
|
||||
if (getFPGASignal(i)==GATE_IN_ACTIVE_HIGH)
|
||||
return IS_SLAVE;
|
||||
else
|
||||
return NO_MASTER;
|
||||
case MASTER_TRIGGERS:
|
||||
case SLAVE_STARTS_WHEN_MASTER_STOPS:
|
||||
if (getFPGASignal(i)==TRIGGER_IN_RISING_EDGE)
|
||||
return IS_SLAVE;
|
||||
else
|
||||
return NO_MASTER;
|
||||
default:
|
||||
return NO_MASTER;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
return NO_MASTER;
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum synchronizationMode setSynchronization(enum synchronizationMode arg){
|
||||
/*
|
||||
int i;
|
||||
|
||||
switch(s) {
|
||||
case NO_SYNCHRONIZATION:
|
||||
syncMode=NO_SYNCHRONIZATION;
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
setFPGASignal(i,SIGNAL_OFF);
|
||||
}
|
||||
}
|
||||
break;
|
||||
// disable external signals?
|
||||
case MASTER_GATES:
|
||||
// configure gate in or out
|
||||
syncMode=MASTER_GATES;
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
if (masterMode==IS_MASTER)
|
||||
setFPGASignal(i,GATE_OUT_ACTIVE_HIGH);
|
||||
else if (masterMode==IS_SLAVE)
|
||||
setFPGASignal(i,GATE_IN_ACTIVE_HIGH);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case MASTER_TRIGGERS:
|
||||
// configure trigger in or out
|
||||
syncMode=MASTER_TRIGGERS;
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
if (masterMode==IS_MASTER)
|
||||
setFPGASignal(i,TRIGGER_OUT_RISING_EDGE);
|
||||
else if (masterMode==IS_SLAVE)
|
||||
setFPGASignal(i,TRIGGER_IN_RISING_EDGE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SLAVE_STARTS_WHEN_MASTER_STOPS:
|
||||
// configure trigger in or out
|
||||
syncMode=SLAVE_STARTS_WHEN_MASTER_STOPS;
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
if (masterMode==IS_MASTER)
|
||||
setFPGASignal(i,RO_TRIGGER_OUT_RISING_EDGE);
|
||||
else if (masterMode==IS_SLAVE)
|
||||
setFPGASignal(i,TRIGGER_IN_RISING_EDGE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
//do nothing
|
||||
;
|
||||
}
|
||||
|
||||
switch (syncMode) {
|
||||
|
||||
case NO_SYNCHRONIZATION:
|
||||
return NO_SYNCHRONIZATION;
|
||||
|
||||
case MASTER_GATES:
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
if (masterMode==IS_MASTER && getFPGASignal(i)==GATE_OUT_ACTIVE_HIGH)
|
||||
return MASTER_GATES;
|
||||
else if (masterMode==IS_SLAVE && getFPGASignal(i)==GATE_IN_ACTIVE_HIGH)
|
||||
return MASTER_GATES;
|
||||
}
|
||||
}
|
||||
return NO_SYNCHRONIZATION;
|
||||
|
||||
case MASTER_TRIGGERS:
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
if (masterMode==IS_MASTER && getFPGASignal(i)==TRIGGER_OUT_RISING_EDGE)
|
||||
return MASTER_TRIGGERS;
|
||||
else if (masterMode==IS_SLAVE && getFPGASignal(i)==TRIGGER_IN_RISING_EDGE)
|
||||
return MASTER_TRIGGERS;
|
||||
}
|
||||
}
|
||||
return NO_SYNCHRONIZATION;
|
||||
|
||||
case SLAVE_STARTS_WHEN_MASTER_STOPS:
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
if (masterMode==IS_MASTER && getFPGASignal(i)==RO_TRIGGER_OUT_RISING_EDGE)
|
||||
return SLAVE_STARTS_WHEN_MASTER_STOPS;
|
||||
else if (masterMode==IS_SLAVE && getFPGASignal(i)==TRIGGER_IN_RISING_EDGE)
|
||||
return SLAVE_STARTS_WHEN_MASTER_STOPS;
|
||||
}
|
||||
}
|
||||
return NO_SYNCHRONIZATION;
|
||||
|
||||
default:
|
||||
return NO_SYNCHRONIZATION;
|
||||
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
return NO_SYNCHRONIZATION;
|
||||
}
|
||||
|
||||
|
@ -20,10 +20,9 @@
|
||||
|
||||
#define FIRMWAREREV 0xcaba //temporary should be in firmware
|
||||
|
||||
/* examples*/
|
||||
/*
|
||||
|
||||
#define NCHAN 256*256
|
||||
#define NCHIP 4*1
|
||||
#define NCHIP 4
|
||||
#define NDAC 16
|
||||
#define NADC 0
|
||||
#define NMAXMODX 1
|
||||
@ -33,8 +32,8 @@
|
||||
#define NDACS NDAC*NMAXMOD
|
||||
|
||||
|
||||
#define DYNAMIC_RANGE 32
|
||||
*/
|
||||
#define DYNAMIC_RANGE 16
|
||||
|
||||
|
||||
enum detDacIndex{SVP,VTR,VRF,VRS,SVN,VTGSTV,VCMP_LL,VCMP_LR,CAL,VCMP_RL,RXB_RB,RXB_LB,VCMP_RR,VCP,VCN,VIS};
|
||||
|
||||
|
@ -4767,3 +4767,20 @@ int multiSlsDetector::enableReceiverCompression(int i){
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::enableTenGigabitEthernet(int i){
|
||||
int ret=-100,ret1;
|
||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++)
|
||||
if (detectors[idet]){
|
||||
ret1=detectors[idet]->enableTenGigabitEthernet(i);
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
if(ret==-100)
|
||||
ret=ret1;
|
||||
else if (ret!=ret1)
|
||||
ret=-1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -1222,6 +1222,12 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
*/
|
||||
int enableReceiverCompression(int i = -1);
|
||||
|
||||
/** enable/disable or 10Gbe
|
||||
* @param i is -1 to get, 0 to disable and 1 to enable
|
||||
/returns if 10Gbe is enabled
|
||||
*/
|
||||
int enableTenGigabitEthernet(int i = -1);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
@ -2929,8 +2929,8 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
||||
case EIGER:
|
||||
//settings is saved in myMod.reg
|
||||
myMod->reg=thisDetector->currentSettings;
|
||||
ostfn << thisDetector->settingsDir << ssettings <<"/settings."<< setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER) << setbase(10);
|
||||
oscfn << thisDetector->calDir << ssettings << "/calibration."<<setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER) << setbase(10);
|
||||
ostfn << thisDetector->settingsDir << ssettings <<"/noise.sn"<< setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER) << setbase(10);
|
||||
oscfn << thisDetector->calDir << ssettings << "/calibration.sn"<<setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER) << setbase(10);
|
||||
#ifdef VERBOSE
|
||||
std::cout<< thisDetector->settingsDir<<endl<< thisDetector->calDir <<endl;
|
||||
#endif
|
||||
@ -2964,11 +2964,11 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
||||
} else {
|
||||
ostringstream ostfn,oscfn;
|
||||
switch(thisDetector->myDetectorType){
|
||||
case EIGER:
|
||||
case MOENCH:
|
||||
case GOTTHARD:
|
||||
ostfn << thisDetector->settingsDir << ssettings << ssettings << ".settings";
|
||||
break;
|
||||
case EIGER:
|
||||
default:
|
||||
ostfn << thisDetector->settingsDir << ssettings << ssettings << ".trim";
|
||||
break;
|
||||
@ -3556,9 +3556,9 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
||||
if (t>=0)
|
||||
thisDetector->timerValue[index]=t;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
//#ifdef VERBOSE
|
||||
std::cout<< "Timer " << index << " set to "<< thisDetector->timerValue[index] << "ns" << std::endl;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
if ((thisDetector->myDetectorType==MYTHEN)&&(index==PROBES_NUMBER)) {
|
||||
setDynamicRange();
|
||||
@ -4102,12 +4102,12 @@ int slsDetector::setDynamicRange(int n){
|
||||
if(thisDetector->myDetectorType==MYTHEN){
|
||||
if (thisDetector->timerValue[PROBES_NUMBER]!=0)
|
||||
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*4;
|
||||
|
||||
if (retval==32)
|
||||
thisDetector->dynamicRange=24;
|
||||
}
|
||||
|
||||
|
||||
if (retval==32)
|
||||
thisDetector->dynamicRange=24;
|
||||
else
|
||||
thisDetector->dynamicRange=retval;
|
||||
|
||||
|
||||
@ -5660,12 +5660,13 @@ int slsDetector::loadSettingsFile(string fname, int imod) {
|
||||
for (int im=mmin; im<mmax; im++) {
|
||||
ostringstream ostfn;
|
||||
ostfn << fname;
|
||||
if (fname.find(".sn")==string::npos && fname.find(".trim")==string::npos && fname.find(".settings")==string::npos) {
|
||||
ostfn << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im);
|
||||
fn=ostfn.str();
|
||||
}
|
||||
if (fname.find(".beb")==string::npos && fname.find(".trim")==string::npos && fname.find(".settings")==string::npos) {
|
||||
ostfn << "." << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER, im);
|
||||
if(thisDetector->myDetectorType != EIGER){
|
||||
if (fname.find(".sn")==string::npos && fname.find(".trim")==string::npos && fname.find(".settings")==string::npos) {
|
||||
ostfn << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im);
|
||||
fn=ostfn.str();
|
||||
}
|
||||
}else if (fname.find(".sn")==string::npos && fname.find(".trim")==string::npos && fname.find(".settings")==string::npos) {
|
||||
ostfn << ".sn" << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER, im);
|
||||
fn=ostfn.str();
|
||||
}
|
||||
myMod=readSettingsFile(fn, thisDetector->myDetectorType);
|
||||
@ -5697,7 +5698,7 @@ int slsDetector::saveSettingsFile(string fname, int imod) {
|
||||
for (int im=mmin; im<mmax; im++) {
|
||||
ostringstream ostfn;
|
||||
if(thisDetector->myDetectorType == EIGER)
|
||||
ostfn << fname << "." << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER);
|
||||
ostfn << fname << ".sn" << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER);
|
||||
else
|
||||
ostfn << fname << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER,im);
|
||||
if ((myMod=getModule(im))) {
|
||||
@ -5725,10 +5726,11 @@ int slsDetector::loadCalibrationFile(string fname, int imod) {
|
||||
for (int im=mmin; im<mmax; im++) {
|
||||
ostringstream ostfn;
|
||||
ostfn << fname ;
|
||||
if (fname.find(".sn")==string::npos && fname.find(".cal")==string::npos) {
|
||||
ostfn << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im);
|
||||
}
|
||||
if (fname.find(".beb")==string::npos && fname.find(".cal")==string::npos) {
|
||||
if(thisDetector->myDetectorType != EIGER){
|
||||
if (fname.find(".sn")==string::npos && fname.find(".cal")==string::npos) {
|
||||
ostfn << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im);
|
||||
}
|
||||
}else if (fname.find(".sn")==string::npos && fname.find(".cal")==string::npos) {
|
||||
ostfn << "." << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER);
|
||||
}
|
||||
fn=ostfn.str();
|
||||
@ -5758,7 +5760,7 @@ int slsDetector::saveCalibrationFile(string fname, int imod) {
|
||||
for (int im=mmin; im<mmax; im++) {
|
||||
ostringstream ostfn;
|
||||
if(thisDetector->myDetectorType == EIGER)
|
||||
ostfn << fname << "." << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER);
|
||||
ostfn << fname << ".sn" << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER);
|
||||
else
|
||||
ostfn << fname << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER,im);
|
||||
if ((myMod=getModule(im))) {
|
||||
@ -6672,3 +6674,53 @@ void slsDetector::setDetectorHostname(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slsDetector::enableTenGigabitEthernet(int i){
|
||||
int ret=FAIL;
|
||||
int retval = -1;
|
||||
int fnum=F_ENABLE_TEN_GIGA,fnum2 = F_ENABLE_RECEIVER_TEN_GIGA;
|
||||
char mess[100];
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< std::endl<< "Enabling / Disabling 10Gbe" << endl;
|
||||
#endif
|
||||
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&i,sizeof(i));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL){
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
setErrorMask((getErrorMask())|(DETECTOR_TEN_GIGA));
|
||||
}
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
controlSocket->Disconnect();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ret!=FAIL){
|
||||
//must also configuremac
|
||||
if((i != -1)&&(retval == i))
|
||||
configureMAC();
|
||||
|
||||
ret = FAIL;
|
||||
retval=-1;
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Enabling / Disabling 10Gbe in receiver: " << i << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK)
|
||||
ret=thisReceiver->sendInt(fnum,retval,i);
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(RECEIVER_TEN_GIGA));
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -1627,6 +1627,12 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
void setDetectorHostname();
|
||||
|
||||
/** enable/disable or 10Gbe
|
||||
* @param i is -1 to get, 0 to disable and 1 to enable
|
||||
/returns if 10Gbe is enabled
|
||||
*/
|
||||
int enableTenGigabitEthernet(int i = -1);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
@ -682,6 +682,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="iodelay"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC;
|
||||
i++;
|
||||
|
||||
|
||||
|
||||
@ -854,6 +857,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="tengiga"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
||||
i++;
|
||||
|
||||
|
||||
numberOfCommands=i;
|
||||
|
||||
@ -3312,6 +3319,8 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action) {
|
||||
dac=E_Vcn;
|
||||
else if (cmd== "vis")
|
||||
dac=E_Vis;
|
||||
else if (cmd== "iodelay")
|
||||
dac=IO_DELAY;
|
||||
else
|
||||
return string("cannot decode dac ")+cmd;
|
||||
|
||||
@ -3849,6 +3858,12 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
|
||||
flag=TOT_MODE;
|
||||
else if (sval=="continous")
|
||||
flag=CONTINOUS_RO;
|
||||
else if (sval=="parallel")
|
||||
flag=PARALLEL;
|
||||
else if (sval=="nonparallel")
|
||||
flag=NONPARALLEL;
|
||||
else if (sval=="safe")
|
||||
flag=SAFE;
|
||||
else
|
||||
return string("could not scan flag ")+string(args[1]);
|
||||
}
|
||||
@ -3865,6 +3880,12 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
|
||||
return string("tot");
|
||||
case CONTINOUS_RO:
|
||||
return string("continous");
|
||||
case PARALLEL:
|
||||
return string("parallel");
|
||||
case NONPARALLEL:
|
||||
return string("nonparallel");
|
||||
case SAFE:
|
||||
return string("safe");
|
||||
default:
|
||||
return string("unknown");
|
||||
}
|
||||
@ -3898,13 +3919,13 @@ string slsDetectorCommand::helpAdvanced(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
|
||||
os << "extsig:i mode \t sets the mode of the external signal i. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
|
||||
os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, unknown" << std::endl;
|
||||
os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, safe, unknown" << std::endl;
|
||||
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
|
||||
os << "extsig:i \t gets the mode of the external signal i. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
|
||||
os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, unknown" << std::endl;
|
||||
os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, safe, unknown" << std::endl;
|
||||
|
||||
}
|
||||
return os.str();
|
||||
@ -4069,6 +4090,17 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
||||
|
||||
}
|
||||
|
||||
else if(cmd=="tengiga"){
|
||||
if (action==PUT_ACTION){
|
||||
if (!sscanf(args[1],"%d",&ival))
|
||||
return string("Could not scan tengiga input ")+string(args[1]);
|
||||
if(ival>=0)
|
||||
sprintf(answer,"%d",myDet->enableTenGigabitEthernet(ival));
|
||||
}else
|
||||
sprintf(answer,"%d",myDet->enableTenGigabitEthernet());
|
||||
return string(answer);
|
||||
|
||||
}
|
||||
|
||||
return string("could not decode command");
|
||||
|
||||
@ -4082,11 +4114,13 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION || action==HELP_ACTION)
|
||||
os << "receiver [status] \t starts/stops the receiver to listen to detector packets. - can be start or stop" << std::endl;
|
||||
os << "r_readfreq \t sets the gui read frequency of the receiver, 0 if gui requests frame, >0 if receiver sends every nth frame to gui" << std::endl;
|
||||
os << "tengiga \t sets system to be configure for 10Gbe if set to 1, else 1Gbe if set to 0" << std::endl;
|
||||
if (action==GET_ACTION || action==HELP_ACTION){
|
||||
os << "receiver \t returns the status of receiver - can be running or idle" << std::endl;
|
||||
os << "framescaught \t returns the number of frames caught by receiver(average for multi)" << std::endl;
|
||||
os << "frameindex \t returns the current frame index of receiver(average for multi)" << std::endl;
|
||||
os << "r_readfreq \t returns the gui read frequency of the receiver" << std::endl;
|
||||
os << "tengiga \t returns 1 if the system is configured for 10Gbe else 0 for 1Gbe" << std::endl;
|
||||
}
|
||||
return os.str();
|
||||
|
||||
|
@ -688,6 +688,13 @@ virtual int setReadReceiverFrequency(int getFromReceiver, int i=-1)=0;
|
||||
*/
|
||||
virtual int enableReceiverCompression(int i = -1)=0;
|
||||
|
||||
/** enable/disable or 10Gbe
|
||||
* @param i is -1 to get, 0 to disable and 1 to enable
|
||||
/returns if 10Gbe is enabled
|
||||
*/
|
||||
virtual int enableTenGigabitEthernet(int i = -1)=0;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
@ -377,8 +377,13 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
|
||||
outfile.open(fname.c_str(), ofstream::binary);
|
||||
if (outfile.is_open()) {
|
||||
iv = 1150;
|
||||
#ifdef VERBOSE
|
||||
for(int i=0;i<mod.ndac;i++)
|
||||
std::cout << "dac " << i << ":" << mod.dacs[i] << std::endl;
|
||||
#endif
|
||||
outfile.write((char*)mod.dacs, sizeof(int)*(mod.ndac));
|
||||
outfile.write((char*)mod.chanregs, sizeof(int)*(mod.nchan));
|
||||
|
||||
outfile.close();
|
||||
return slsDetectorDefs::OK;
|
||||
}
|
||||
|
@ -37,6 +37,15 @@ int detectorTest( enum digitalTestMode arg);
|
||||
int setDAC(enum detDacIndex ind, int val, int imod);
|
||||
int getADC(enum detDacIndex ind, int imod);
|
||||
|
||||
#if defined(EIGERD) || defined(GOTTHARD)
|
||||
int setHighVolage(int val, int imod);
|
||||
#endif
|
||||
|
||||
#ifdef EIGERD
|
||||
int setIODelay(int val, int imod);
|
||||
int enableTenGigabitEthernet(int val);
|
||||
#endif
|
||||
|
||||
#if defined(MYTHEND) || defined(GOTTHARDD)
|
||||
u_int32_t writeRegister(u_int32_t offset, u_int32_t data);
|
||||
u_int32_t readRegister(u_int32_t offset);
|
||||
@ -97,6 +106,8 @@ int calibratePedestal(int frames);
|
||||
#endif
|
||||
|
||||
|
||||
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod);
|
||||
|
||||
int calculateDataBytes();
|
||||
int getTotalNumberOfChannels();
|
||||
int getTotalNumberOfChips();
|
||||
|
@ -156,6 +156,8 @@ int function_table() {
|
||||
flist[F_START_RECEIVER]=&start_receiver;
|
||||
flist[F_STOP_RECEIVER]=&stop_receiver;
|
||||
flist[F_CALIBRATE_PEDESTAL]=&calibrate_pedestal;
|
||||
flist[F_ENABLE_TEN_GIGA]=&enable_ten_giga;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
@ -793,23 +795,33 @@ enum externalCommunicationMode{
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
if (ret==OK) {
|
||||
/* execute action */
|
||||
|
||||
retval=setTiming(arg);
|
||||
|
||||
/* switch(arg) { */
|
||||
/* default: */
|
||||
/* sprintf(mess,"The meaning of single signals should be set\n"); */
|
||||
/* ret=FAIL; */
|
||||
/* } */
|
||||
|
||||
|
||||
switch(arg){
|
||||
#ifdef EIGERD
|
||||
case GET_EXTERNAL_COMMUNICATION_MODE:
|
||||
case AUTO_TIMING:
|
||||
case TRIGGER_EXPOSURE:
|
||||
case TRIGGER_READOUT:
|
||||
case GATE_FIX_NUMBER:
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ret = FAIL;
|
||||
sprintf("This timing mode %d not implemented in this detector\n",(int)arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ret==OK) {
|
||||
#ifdef VERBOSE
|
||||
printf("Setting external communication mode to %d\n", arg);
|
||||
#endif
|
||||
} else
|
||||
ret=FAIL;
|
||||
retval=setTiming(arg);
|
||||
|
||||
if (differentClients==1)
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* send answer */
|
||||
/* send OK/failed */
|
||||
//ret could be swapped during sendData
|
||||
@ -1149,6 +1161,10 @@ int set_dac(int file_des) {
|
||||
case E_Vis:
|
||||
idac = VIS;
|
||||
break;
|
||||
case HV_POT:
|
||||
break;
|
||||
case IO_DELAY:
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
printf("Unknown DAC index %d\n",(int)ind);
|
||||
@ -1164,15 +1180,21 @@ int set_dac(int file_des) {
|
||||
if (differentClients==1 && lockStatus==1 && val!=-1) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else
|
||||
retval=setDAC(idac,val,imod);
|
||||
} else{
|
||||
if(ind == HV_POT)
|
||||
retval = setHighVolage(val,imod);
|
||||
else if(ind == IO_DELAY)
|
||||
retval = setIODelay(val,imod);
|
||||
else
|
||||
retval=setDAC(idac,val,imod);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef VERBOSE
|
||||
printf("DAC set to %d V\n", retval);
|
||||
#endif
|
||||
if(ret == OK){
|
||||
if (retval==val || val==-1) {
|
||||
if ((abs(retval-val)<=5) || val==-1) {
|
||||
ret=OK;
|
||||
if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
@ -2406,22 +2428,22 @@ int set_timer(int file_des) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (ret!=OK) {
|
||||
printf(mess);
|
||||
if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
if (ret!=OK) {
|
||||
printf(mess);
|
||||
printf("set timer failed\n");
|
||||
sprintf(mess, "set timer %d failed\n", ind);
|
||||
} else if (ind==FRAME_NUMBER) {
|
||||
/*ret=allocateRAM();*/
|
||||
}
|
||||
else{
|
||||
#if defined(MYTHEND) || defined(GOTTHARD)
|
||||
if (ind==FRAME_NUMBER) {
|
||||
ret=allocateRAM();
|
||||
if (ret!=OK)
|
||||
sprintf(mess, "could not allocate RAM for %lld frames\n", tns);
|
||||
}
|
||||
|
||||
#endif
|
||||
if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
//ret could be swapped during sendData
|
||||
ret1 = ret;
|
||||
n = sendData(file_des,&ret1,sizeof(ret),INT32);
|
||||
@ -2590,10 +2612,7 @@ int set_readout_flags(int file_des) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
#ifndef MYTHEND
|
||||
ret = FAIL;
|
||||
strcpy(mess,"Not applicable/implemented for this detector\n");
|
||||
#else
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("setting readout flags to %d\n",arg);
|
||||
#endif
|
||||
@ -2604,31 +2623,35 @@ int set_readout_flags(int file_des) {
|
||||
} else {
|
||||
switch(arg) {
|
||||
case GET_READOUT_FLAGS:
|
||||
#ifdef MYTHEND
|
||||
case STORE_IN_RAM:
|
||||
case TOT_MODE:
|
||||
case CONTINOUS_RO:
|
||||
case NORMAL_READOUT:
|
||||
if (myDetectorType==MYTHEN) {
|
||||
retval=setReadOutFlags(arg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
retval=setReadOutFlags(arg);
|
||||
break;
|
||||
#elif EIGERD
|
||||
case PARALLEL:
|
||||
case NONPARALLEL:
|
||||
case SAFE:
|
||||
retval=setReadOutFlags(arg);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
sprintf(mess,"Unknown readout flag %d\n", arg);
|
||||
sprintf(mess,"Unknown readout flag %d for this detector\n", arg);
|
||||
ret=FAIL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (ret==OK) {
|
||||
if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
if (arg!=GET_READOUT_FLAGS && arg!=retval) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Could not change readout flag: should be %d but is %d\n", arg, retval);
|
||||
}
|
||||
}else if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//ret could be swapped during sendData
|
||||
ret1 = ret;
|
||||
@ -2752,10 +2775,7 @@ int set_speed(int file_des) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
#ifndef MYTHEND
|
||||
ret = FAIL;
|
||||
strcpy(mess,"Not applicable/implemented for this detector\n");
|
||||
#else
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("setting speed variable %d to %d\n",arg,val);
|
||||
#endif
|
||||
@ -2767,33 +2787,36 @@ int set_speed(int file_des) {
|
||||
} else {
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
switch (arg) {
|
||||
#ifdef MYTHEND
|
||||
case CLOCK_DIVIDER:
|
||||
case WAIT_STATES:
|
||||
case SET_SIGNAL_LENGTH:
|
||||
case TOT_CLOCK_DIVIDER:
|
||||
case TOT_DUTY_CYCLE:
|
||||
if (myDetectorType==MYTHEN) {
|
||||
retval=setSpeed(arg, val);
|
||||
break;
|
||||
}
|
||||
retval=setSpeed(arg, val);
|
||||
break;
|
||||
#elif EIGERD
|
||||
case CLOCK_DIVIDER:
|
||||
retval=setSpeed(arg, val);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
sprintf(mess,"unknown speed variable %d\n",arg);
|
||||
sprintf(mess,"unknown speed variable %d for this detector\n",arg);
|
||||
ret=FAIL;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (ret==OK && val>=0) {
|
||||
if (retval!=val) {
|
||||
if (ret==OK){
|
||||
if ((retval!=val) && (val>=0)) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"could not change speed variable %d: should be %d but is %d \n",arg, val, retval);
|
||||
}
|
||||
}else if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
|
||||
}
|
||||
if (differentClients && ret==OK)
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//ret could be swapped during sendData
|
||||
ret1 = ret;
|
||||
@ -3340,3 +3363,48 @@ int calibrate_pedestal(int file_des){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int enable_ten_giga(int file_des) {
|
||||
int n;
|
||||
int retval;
|
||||
int ret=OK,ret1=OK;
|
||||
int arg = -1;
|
||||
|
||||
sprintf(mess,"Can't enable/disable 10Gbe \n");
|
||||
/* receive arguments */
|
||||
n = receiveData(file_des,&arg,sizeof(arg),INT32);
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
/* execute action */
|
||||
if(ret != FAIL){
|
||||
#ifdef VERBOSE
|
||||
printf("Enabling 10Gbe :%d \n",arg);
|
||||
#endif
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
retval=enableTenGigabitEthernet(arg);
|
||||
if((arg != -1) && (retval != arg))
|
||||
ret=FAIL;
|
||||
else if (differentClients==1 && ret==OK) {
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/* send answer */
|
||||
/* send OK/failed */
|
||||
//ret could be swapped during sendData
|
||||
ret1 = ret;
|
||||
n = sendData(file_des,&ret1,sizeof(ret),INT32);
|
||||
if (ret==FAIL)
|
||||
n += sendData(file_des,mess,sizeof(mess),OTHER);
|
||||
/* send return argument */
|
||||
n += sendData(file_des,&retval,sizeof(retval),INT32);
|
||||
/*return ok/fail*/
|
||||
return ret;
|
||||
}
|
||||
|
@ -80,5 +80,6 @@ int reset_counter_block(int);
|
||||
int start_receiver(int);
|
||||
int stop_receiver(int);
|
||||
int calibrate_pedestal(int);
|
||||
int enable_ten_giga(int);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user