mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +02:00
somewhere in between
This commit is contained in:
parent
f74710998d
commit
2465eafff0
@ -84,6 +84,8 @@ int normal = 0;
|
||||
|
||||
|
||||
void checkFirmwareCompatibility(){
|
||||
uint32_t ipadd = getDetectorIP();
|
||||
uint64_t macadd = getDetectorMAC();
|
||||
int64_t fwversion = getDetectorId(DETECTOR_FIRMWARE_VERSION);
|
||||
int64_t swversion = getDetectorId(DETECTOR_SOFTWARE_VERSION);
|
||||
int64_t sw_fw_apiversion = getDetectorId(SOFTWARE_FIRMWARE_API_VERSION);
|
||||
@ -92,12 +94,17 @@ void checkFirmwareCompatibility(){
|
||||
"**********************EIGER Server**********************\n"
|
||||
"********************************************************\n");
|
||||
cprintf(BLUE,"\n"
|
||||
"Detector IP Addr:\t\t 0x%x\n"
|
||||
"Detector MAC Addr:\t\t 0x%llx\n"
|
||||
|
||||
"Firmware Version:\t\t %lld\n"
|
||||
"Software Version:\t\t %llx\n"
|
||||
"F/w-S/w API Version:\t\t %lld\n"
|
||||
"Required Firmware Version:\t %d\n"
|
||||
"\n********************************************************\n",
|
||||
fwversion,swversion,sw_fw_apiversion,REQUIRED_FIRMWARE_VERSION);
|
||||
ipadd, macadd,
|
||||
fwversion,swversion,
|
||||
sw_fw_apiversion,REQUIRED_FIRMWARE_VERSION);
|
||||
|
||||
//cant read versions
|
||||
if(!fwversion || !sw_fw_apiversion){
|
||||
@ -182,33 +189,17 @@ u_int64_t getFirmwareVersion() {
|
||||
return Beb_GetFirmwareRevision();
|
||||
}
|
||||
|
||||
int64_t getModuleId(enum idMode arg, int imod){
|
||||
|
||||
/**/
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int getDetectorNumber(){
|
||||
int res=0;
|
||||
|
||||
u_int32_t getDetectorNumber(){
|
||||
u_int32_t res=0;
|
||||
//execute and get address
|
||||
char output[255];
|
||||
FILE* sysFile = popen("more /home/root/executables/detid.txt", "r");
|
||||
fgets(output, sizeof(output), sysFile);
|
||||
pclose(sysFile);
|
||||
sscanf(output,"%d",&res);
|
||||
printf("detector id: %d\n",res);
|
||||
|
||||
/*
|
||||
int res=0;
|
||||
char hostname[100];
|
||||
if (gethostname(hostname, sizeof hostname) == 0)
|
||||
puts(hostname);
|
||||
else
|
||||
perror("gethostname");
|
||||
sscanf(hostname,"%x",&res);
|
||||
*/
|
||||
sscanf(output,"%u",&res);
|
||||
printf("detector id: %u\n",res);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -242,9 +233,9 @@ u_int64_t getDetectorMAC() {
|
||||
|
||||
|
||||
|
||||
int getDetectorIP(){
|
||||
u_int32_t getDetectorIP(){
|
||||
char temp[50]="";
|
||||
int res=0;
|
||||
u_int32_t res=0;
|
||||
//execute and get address
|
||||
char output[255];
|
||||
FILE* sysFile = popen("ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2", "r");
|
||||
@ -268,46 +259,7 @@ int getDetectorIP(){
|
||||
|
||||
|
||||
|
||||
int initDetector(){
|
||||
int imod,i,n;
|
||||
n = getNModBoard(1);
|
||||
|
||||
//#ifdef VERBOSE
|
||||
printf("This Server is for 1 Eiger half module\n");
|
||||
//#endif
|
||||
|
||||
|
||||
//Allocation of memory
|
||||
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;
|
||||
}
|
||||
thisSettings = UNINITIALIZED;
|
||||
|
||||
|
||||
void initControlServer(){
|
||||
//Feb and Beb Initializations
|
||||
getModuleConfiguration();
|
||||
Feb_Interface_FebInterface();
|
||||
@ -322,6 +274,75 @@ int initDetector(){
|
||||
Beb_Beb();
|
||||
printf("BEB Initialization done\n");
|
||||
|
||||
|
||||
setupDetector();
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void initStopServer(){
|
||||
getModuleConfiguration();
|
||||
Feb_Interface_FebInterface();
|
||||
Feb_Control_FebControl();
|
||||
Feb_Control_Init(master,top,normal,getDetectorNumber());
|
||||
printf("FEB Initialization done\n");
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
void getModuleConfiguration(){
|
||||
int *m=&master;
|
||||
int *t=⊤
|
||||
int *n=&normal;
|
||||
Beb_GetModuleConfiguration(m,t,n);
|
||||
if(top) printf("*************** TOP ***************\n");
|
||||
else printf("*************** BOTTOM ***************\n");
|
||||
if(master) printf("*************** MASTER ***************\n");
|
||||
else printf("*************** SLAVE ***************\n");
|
||||
if(normal) printf("*************** NORMAL ***************\n");
|
||||
else printf("*************** SPECIAL ***************\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void allocateDetectorStructureMemory(){
|
||||
printf("This Server is for 1 Eiger half module (250k)\n");
|
||||
|
||||
//Allocation of memory
|
||||
detectorModules=malloc(sizeof(sls_detector_module));
|
||||
detectorChips=malloc(NCHIP*sizeof(int));
|
||||
detectorChans=malloc(NCHIP*NCHAN*sizeof(int));
|
||||
detectorDacs=malloc(NDAC*sizeof(dacs_t));
|
||||
detectorAdcs=malloc(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
|
||||
(detectorModules)->dacs=detectorDacs;
|
||||
(detectorModules)->adcs=detectorAdcs;
|
||||
(detectorModules)->chipregs=detectorChips;
|
||||
(detectorModules)->chanregs=detectorChans;
|
||||
(detectorModules)->ndac=NDAC;
|
||||
(detectorModules)->nadc=NADC;
|
||||
(detectorModules)->nchip=NCHIP;
|
||||
(detectorModules)->nchan=NCHIP*NCHAN;
|
||||
(detectorModules)->module=imod;
|
||||
(detectorModules)->gain=0;
|
||||
(detectorModules)->offset=0;
|
||||
(detectorModules)->reg=0;
|
||||
thisSettings = UNINITIALIZED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void setupDetector() {
|
||||
|
||||
allocateDetectorStructureMemory();
|
||||
|
||||
//Get dac values
|
||||
int retval[2];
|
||||
for(i=0;i<(detectorModules)->ndac;i++)
|
||||
@ -343,56 +364,12 @@ int initDetector(){
|
||||
int enable[2] = {0,1};
|
||||
setExternalGating(enable);//disable external gating
|
||||
Feb_Control_SetInTestModeVariable(0);
|
||||
setHighVoltage(0,0);
|
||||
setHighVoltage(0);
|
||||
Feb_Control_CheckSetup();
|
||||
|
||||
//print detector mac and ip
|
||||
printf("mac read from detector: %llx\n",getDetectorMAC());
|
||||
printf("ip read from detector: %x\n",getDetectorIP());
|
||||
|
||||
|
||||
printf("\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int initDetectorStop(){
|
||||
getModuleConfiguration();
|
||||
Feb_Interface_FebInterface();
|
||||
Feb_Control_FebControl();
|
||||
Feb_Control_Init(master,top,normal,getDetectorNumber());
|
||||
printf("FEB Initialization done\n");
|
||||
/* Beb_Beb(-1);
|
||||
printf("BEB constructor done\n");*/
|
||||
|
||||
printf("\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void getModuleConfiguration(){
|
||||
int *m=&master;
|
||||
int *t=⊤
|
||||
int *n=&normal;
|
||||
/*if(getDetectorNumber() == 0xbeb015){
|
||||
master = 1;
|
||||
top = 1;
|
||||
}*/
|
||||
Beb_GetModuleConfiguration(m,t,n);
|
||||
if(top) printf("*************** TOP ***************\n");
|
||||
else printf("*************** BOTTOM ***************\n");
|
||||
if(master) printf("*************** MASTER ***************\n");
|
||||
else printf("*************** SLAVE ***************\n");
|
||||
if(normal) printf("*************** NORMAL ***************\n");
|
||||
else printf("*************** SPECIAL ***************\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
int setNMod(int nm, enum dimension dim){
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int getNModBoard(enum dimension arg){
|
||||
@ -404,11 +381,6 @@ int getNModBoard(enum dimension arg){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]){
|
||||
|
||||
if(ind == VTHRESHOLD){
|
||||
@ -469,7 +441,7 @@ void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]){
|
||||
|
||||
|
||||
|
||||
int setHighVoltage(int val, int imod){
|
||||
int setHighVoltage(int val){
|
||||
if(val!=-1){
|
||||
eiger_highvoltage = val;
|
||||
if(master){
|
||||
@ -1064,21 +1036,20 @@ int executeTrimming(enum trimMode mode, int par1, int par2, int imod){
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport, int udpport2, int ival){
|
||||
if (detectormacadd != getDetectorMAC()){
|
||||
if (sourcemac != getDetectorMAC()){
|
||||
printf("*************************************************\n");
|
||||
printf("WARNING: actual detector mac address %llx does not match the one from client %llx\n",getDetectorMAC(),detectormacadd);
|
||||
detectormacadd = getDetectorMAC();
|
||||
printf("WARNING: actual detector mac address %llx does not match the one from client %llx\n",getDetectorMAC(),sourcemac);
|
||||
sourcemac = getDetectorMAC();
|
||||
printf("WARNING: Matched detectormac to the hardware mac now\n");
|
||||
printf("*************************************************\n");
|
||||
}
|
||||
//only for 1Gbe
|
||||
if(!send_to_ten_gig){
|
||||
if (detipad != getDetectorIP()){
|
||||
if (sourceip != getDetectorIP()){
|
||||
printf("*************************************************\n");
|
||||
printf("WARNING: actual detector ip address %x does not match the one from client %x\n",getDetectorIP(),detipad);
|
||||
detipad = getDetectorIP();
|
||||
printf("WARNING: actual detector ip address %x does not match the one from client %x\n",getDetectorIP(),sourceip);
|
||||
sourceip = getDetectorIP();
|
||||
printf("WARNING: Matched detector ip to the hardware ip now\n");
|
||||
printf("*************************************************\n");
|
||||
}
|
||||
@ -1086,20 +1057,20 @@ int configureMAC(int ipad, long long int macad, long long int detectormacadd, in
|
||||
|
||||
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
|
||||
int src_port = 0xE185;
|
||||
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,"%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,"%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));
|
||||
sprintf(src_ip,"%d.%d.%d.%d",(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff);
|
||||
sprintf(dst_ip,"%d.%d.%d.%d",(destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff);
|
||||
sprintf(src_mac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((sourcemac>>40)&0xFF),
|
||||
(unsigned int)((sourcemac>>32)&0xFF),
|
||||
(unsigned int)((sourcemac>>24)&0xFF),
|
||||
(unsigned int)((sourcemac>>16)&0xFF),
|
||||
(unsigned int)((sourcemac>>8)&0xFF),
|
||||
(unsigned int)((sourcemac>>0)&0xFF));
|
||||
sprintf(dst_mac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((destmac>>40)&0xFF),
|
||||
(unsigned int)((destmac>>32)&0xFF),
|
||||
(unsigned int)((destmac>>24)&0xFF),
|
||||
(unsigned int)((destmac>>16)&0xFF),
|
||||
(unsigned int)((destmac>>8)&0xFF),
|
||||
(unsigned int)((destmac>>0)&0xFF));
|
||||
|
||||
printf("src_port:%d\n",src_port);
|
||||
printf("src_ip:%s\n",src_ip);
|
||||
|
@ -1148,24 +1148,6 @@ int getTemperature(int tempSensor, int imod){
|
||||
}
|
||||
|
||||
|
||||
//settings
|
||||
int initConfGain(int isettings,int val,int imod){
|
||||
int retval;
|
||||
u_int32_t addr=DAQ_REG;
|
||||
if(isettings!=-1){
|
||||
//#ifdef VERBOSE
|
||||
printf("Setting Gain with val:0x%x\n",val);
|
||||
//#endif
|
||||
bus_w(addr,val);
|
||||
}
|
||||
retval=bus_r(addr);
|
||||
//#ifdef VERBOSE
|
||||
printf("Gain Reg Value is 0x%x\n",bus_r(addr));
|
||||
//#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -171,7 +171,7 @@ int setSettings(int i, int imod) {
|
||||
int isett=-1,val=-1,retval=-1;
|
||||
enum conf_gain {
|
||||
dynamic = 0x0f00, //dynamic
|
||||
dynamichighgain0 = 0x0f01, //dynamichighgain0
|
||||
dynamichighgain0 = v, //dynamichighgain0
|
||||
fixgain1 = 0x0f02, //fixgain1
|
||||
fixgain2 = 0x0f06, //fixgain2
|
||||
forceswitchgain1 = 0x1f00, //forceswitchgain1
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,8 +8,25 @@
|
||||
|
||||
|
||||
#define GOODBYE (-200)
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
//#define REQUIRED_FIRMWARE_VERSION 16
|
||||
//#define FIRMWAREREV 0xcaba //temporary should be in firmware
|
||||
|
||||
/* Struct Definitions */
|
||||
typedef struct ip_header_struct {
|
||||
u_int16_t ip_len;
|
||||
u_int8_t ip_tos;
|
||||
u_int8_t ip_ihl:4 ,ip_ver:4;
|
||||
u_int16_t ip_offset:13,ip_flag:3;
|
||||
u_int16_t ip_ident;
|
||||
u_int16_t ip_chksum;
|
||||
u_int8_t ip_protocol;
|
||||
u_int8_t ip_ttl;
|
||||
u_int32_t ip_sourceip;
|
||||
u_int32_t ip_destip;
|
||||
} ip_header;
|
||||
|
||||
/* Enums */
|
||||
enum clkspeed {FULL_SPEED, HALF_SPEED, QUARTER_SPEED};
|
||||
enum ADC_INDEX {TEMP_FPGA, TEMP_ADC};
|
||||
enum DAC_INDEX { VB_COMP, VDD_PROT, VIN_COM, VREF_PRECH, VB_PIXBUF, VB_DS, VREF_DS, VREF_COMP };
|
||||
@ -23,14 +40,24 @@ enum DAC_INDEX { VB_COMP, VDD_PROT, VIN_COM, VREF_PRECH, VB_PIXBUF, VB_DS, VR
|
||||
420 /* VREF_COMP */ \
|
||||
};
|
||||
|
||||
#define NUM_SETTINGS 6
|
||||
#define DEFAULT_SETT_INDX {DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2};
|
||||
#define DEFAULT_SETT_VALS { 0x0f00, /* DYNAMICGAIN */ \
|
||||
0x0f01, /* DYNAMICHG0 */ \
|
||||
0x0f02, /* FIXGAIN1 */ \
|
||||
0x0f06, /* FIXGAIN2 */ \
|
||||
0x1f00, /* FORCESWITCHG1 */ \
|
||||
0x3f00 /* FORCESWITCHG2 */ \
|
||||
};
|
||||
|
||||
|
||||
/* Hardware Definitions */
|
||||
#define NMAXMODY (1)
|
||||
#define NMAXMODX (1)
|
||||
#define NMAXMOD (NMAXMODX * NMAXMODY)
|
||||
//#define NMODY (1)
|
||||
//#define NMODX (1)
|
||||
//#define NMOD (NMODX * NMODY)
|
||||
#define NMODY (1)
|
||||
#define NMODX (1)
|
||||
#define NMOD (NMODX * NMODY)
|
||||
#define NCHAN (256 * 256)
|
||||
#define NCHIP (8)
|
||||
#define NADC (0)
|
||||
|
@ -32,43 +32,141 @@ int detectorTest( enum digitalTestMode arg);
|
||||
// Ids
|
||||
int64_t getDetectorId(enum idMode arg);
|
||||
u_int64_t getFirmwareVersion();
|
||||
#ifdef MYTHEND
|
||||
int64_t getModuleId(enum idMode arg, int imod);
|
||||
int getDetectorNumber();
|
||||
#elif JUNGFRAUD
|
||||
u_int16_t getHardwareVersionNumber();
|
||||
u_int16_t getHardwareSerialNumber();
|
||||
#endif
|
||||
u_int32_t getDetectorNumber();
|
||||
u_int64_t getDetectorMAC();
|
||||
int getDetectorIP();
|
||||
u_int32_t getDetectorIP();
|
||||
|
||||
|
||||
// initialization
|
||||
int initDetector();
|
||||
void initControlServer();
|
||||
void initStopServer();
|
||||
#ifdef EIGERD
|
||||
int initDetectorStop();
|
||||
void getModuleConfiguration();
|
||||
#endif
|
||||
|
||||
#ifdef JUNGFRAUD
|
||||
int mapCSP0(void);
|
||||
u_int16_t bus_w16(u_int32_t offset, u_int16_t data);
|
||||
void bus_w16(u_int32_t offset, u_int16_t data);
|
||||
u_int16_t bus_r16(u_int32_t offset);
|
||||
u_int32_t bus_w(u_int32_t offset, u_int32_t data);
|
||||
void bus_w(u_int32_t offset, u_int32_t data);
|
||||
u_int32_t bus_r(u_int32_t offset);
|
||||
int64_t set64BitReg(int64_t value, int aLSB, int aMSB);
|
||||
int64_t get64BitReg(int aLSB, int aMSB);
|
||||
void defineGPIOpins();
|
||||
void resetFPGA();
|
||||
void FPGAdontTouchFlash();
|
||||
void FPGATouchFlash();
|
||||
#endif
|
||||
|
||||
// set up detector
|
||||
void allocateDetectorStructureMemory();
|
||||
void setupDetector();
|
||||
|
||||
|
||||
// advanced read/write reg
|
||||
#ifndef EIGERD
|
||||
u_int32_t writeRegister(u_int32_t offset, u_int32_t data);
|
||||
u_int32_t readRegister(u_int32_t offset);
|
||||
#endif
|
||||
|
||||
|
||||
int setNMod(int nm, enum dimension dim);
|
||||
int getNModBoard(enum dimension arg);
|
||||
|
||||
// firmware functions (resets)
|
||||
#ifdef JUNGFRAUD
|
||||
int powerChip (int on);
|
||||
void cleanFifos();
|
||||
void resetCore();
|
||||
void resetPeripheral();
|
||||
int adcPhase(int st);
|
||||
int getPhase();
|
||||
#endif
|
||||
|
||||
// parameters - nmod, dr, roi
|
||||
int setNMod(int nm, enum dimension dim); // mythen specific, but for detector compatibility as a get
|
||||
int getNModBoard(enum dimension arg); // mythen specific, but for detector compatibility as a get
|
||||
int setDynamicRange(int dr);
|
||||
#ifdef MYTHEND
|
||||
int setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
||||
#endif
|
||||
|
||||
// parameters - readout
|
||||
int setSpeed(enum speedVariable arg, int val);
|
||||
#if defined(EIGERD) || defined(MYTHEND)
|
||||
enum readOutFlags setReadOutFlags(enum readOutFlags val);
|
||||
int executeTrimming(enum trimMode mode, int par1, int par2, int imod);
|
||||
#endif
|
||||
|
||||
// parameters - timer
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val);
|
||||
int64_t getTimeLeft(enum timerIndex ind);
|
||||
|
||||
// parameters - channel, chip, module, settings
|
||||
#ifdef MYTHEND
|
||||
int setChannel(sls_detector_channel myChan);
|
||||
int getChannel(sls_detector_channel *myChan);
|
||||
int setChip(sls_detector_chip myChip);
|
||||
int getChip(sls_detector_chip *myChip);
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
int setModule(sls_detector_module myMod, int delay);
|
||||
#else
|
||||
int setModule(sls_detector_module myMod);
|
||||
#endif
|
||||
int getModule(sls_detector_module *myMod);
|
||||
enum detectorSettings setSettings(enum detectorSettings sett, int imod);
|
||||
enum detectorSettings getSettings();
|
||||
|
||||
|
||||
#if defined(MYTHEND) || defined(EIGERD)
|
||||
// parameters - threshold
|
||||
int getThresholdEnergy(int imod);
|
||||
int setThresholdEnergy(int ev, int imod);
|
||||
#endif
|
||||
|
||||
// parameters - dac, adc, hv
|
||||
void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]);
|
||||
int getADC(enum detAdcIndex ind, int imod);
|
||||
|
||||
|
||||
#if defined(EIGERD) || defined(GOTTHARD)
|
||||
int setHighVoltage(int val, int imod);
|
||||
#ifndef MYTHEND
|
||||
int setHighVoltage(int val);
|
||||
#endif
|
||||
|
||||
#ifdef EIGERD
|
||||
// parameters - timing, extsig
|
||||
#ifdef MYTHEND
|
||||
enum externalSignalFlag getExtSignal(int signalindex);
|
||||
enum externalSignalFlag setExtSignal(int signalindex, enum externalSignalFlag flag);
|
||||
#endif
|
||||
enum externalCommunicationMode setTiming( enum externalCommunicationMode arg);
|
||||
|
||||
// configure mac
|
||||
#ifdef JUNGFRAUD
|
||||
long int calcChecksum(int sourceip, int destip);
|
||||
#endif
|
||||
#ifndef MYTHEND
|
||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2, int ival);
|
||||
#endif
|
||||
|
||||
|
||||
// very detector specific
|
||||
#ifdef GOTTHARDD
|
||||
// gotthard specific - image, pedestal
|
||||
int loadImage(enum imageType index, char *imageVals);
|
||||
int readCounterBlock(int startACQ, char *counterVals);
|
||||
int resetCounterBlock(int startACQ);
|
||||
int calibratePedestal(int frames);
|
||||
|
||||
#elif JUNGFRAUD
|
||||
// jungfrau specific - flashing fpga
|
||||
void eraseFlash();
|
||||
int startWritingFPGAprogram(FILE** filefp);
|
||||
int stopWritingFPGAprogram(FILE* filefp);
|
||||
int writeFPGAProgram(char* fpgasrc, size_t fsize, FILE* filefp);
|
||||
|
||||
#elif EIGERD
|
||||
//eiger specific - iodelay, 10g, pulse, rate, temp, activate, delay nw parameter
|
||||
int setIODelay(int val, int imod);
|
||||
int enableTenGigabitEthernet(int val);
|
||||
int setCounterBit(int val);
|
||||
@ -80,36 +178,21 @@ int getRateCorrectionEnable();
|
||||
int getDefaultSettingsTau_in_nsec();
|
||||
void setDefaultSettingsTau_in_nsec(int t);
|
||||
int64_t getCurrentTau();
|
||||
#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);
|
||||
#endif
|
||||
|
||||
#ifdef MYTHEND
|
||||
int setChannel(sls_detector_channel myChan);
|
||||
int getChannel(sls_detector_channel *myChan);
|
||||
int setChip(sls_detector_chip myChip);
|
||||
int getChip(sls_detector_chip *myChip);
|
||||
void setExternalGating(int enable[]);
|
||||
int setAllTrimbits(int val);
|
||||
int getAllTrimbits();
|
||||
int getBebFPGATemp();
|
||||
int activate(int enable);
|
||||
int setNetworkParameter(enum detNetworkParameter mode, int value);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef EIGERD
|
||||
int setModule(sls_detector_module myMod, int delay);
|
||||
#else
|
||||
int setModule(sls_detector_module myMod);
|
||||
|
||||
|
||||
// aquisition
|
||||
#ifdef defined(EIGERD) || defined(GOTTHARD)
|
||||
int startReceiver(int d);
|
||||
#endif
|
||||
|
||||
int getModule(sls_detector_module *myMod);
|
||||
enum detectorSettings setSettings(enum detectorSettings sett, int imod);
|
||||
enum detectorSettings getSettings();
|
||||
|
||||
#if defined(MYTHEND) || defined(EIGERD)
|
||||
int getThresholdEnergy(int imod);
|
||||
int setThresholdEnergy(int ev, int imod);
|
||||
#endif
|
||||
|
||||
int startStateMachine();
|
||||
int stopStateMachine();
|
||||
int startReadOut();
|
||||
@ -117,38 +200,8 @@ enum runStatus getRunStatus();
|
||||
void readFrame(int *ret, char *mess);
|
||||
|
||||
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val);
|
||||
int64_t getTimeLeft(enum timerIndex ind);
|
||||
|
||||
|
||||
int setDynamicRange(int dr);
|
||||
int setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
||||
|
||||
|
||||
#if defined(EIGERD) || defined(MYTHEND)
|
||||
enum readOutFlags setReadOutFlags(enum readOutFlags val);
|
||||
int setSpeed(enum speedVariable arg, int val);
|
||||
int executeTrimming(enum trimMode mode, int par1, int par2, int imod);
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MYTHEND
|
||||
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport, int udpport2, int ival);
|
||||
#endif
|
||||
|
||||
#ifdef GOTTHARDD
|
||||
int loadImage(enum imageType index, char *imageVals);
|
||||
int readCounterBlock(int startACQ, char *counterVals);
|
||||
int resetCounterBlock(int startACQ);
|
||||
int startReceiver(int d);
|
||||
int calibratePedestal(int frames);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
//common
|
||||
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod);
|
||||
|
||||
int calculateDataBytes();
|
||||
int getTotalNumberOfChannels();
|
||||
int getTotalNumberOfChips();
|
||||
@ -163,25 +216,11 @@ int getNumberOfGainsPerModule();
|
||||
int getNumberOfOffsetsPerModule();
|
||||
#endif
|
||||
|
||||
enum externalSignalFlag getExtSignal(int signalindex);
|
||||
enum externalSignalFlag setExtSignal(int signalindex, enum externalSignalFlag flag);
|
||||
enum externalCommunicationMode setTiming( enum externalCommunicationMode arg);
|
||||
// sync
|
||||
enum masterFlags setMaster(enum masterFlags arg);
|
||||
enum synchronizationMode setSynchronization(enum synchronizationMode arg);
|
||||
|
||||
#ifdef EIGERD
|
||||
int startReceiver(int d);
|
||||
void setExternalGating(int enable[]);
|
||||
int setAllTrimbits(int val);
|
||||
int getAllTrimbits();
|
||||
int getBebFPGATemp();
|
||||
int activate(int enable);
|
||||
int setNetworkParameter(enum detNetworkParameter mode, int value);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -48,14 +48,13 @@ void basictests() {
|
||||
}
|
||||
|
||||
|
||||
int init_detector(int b) {
|
||||
int init_detector(int controlserver) {
|
||||
#ifdef VIRTUAL
|
||||
printf("This is a VIRTUAL detector\n");
|
||||
#endif
|
||||
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
if(b) initDetector();
|
||||
else initDetectorStop();
|
||||
if (controlserver) initControlServer();
|
||||
else initStopServer();
|
||||
#endif
|
||||
strcpy(mess,"dummy message");
|
||||
strcpy(lastClientIP,"none");
|
||||
@ -885,7 +884,7 @@ int get_id(int file_des) {
|
||||
#endif
|
||||
|
||||
switch (arg) {
|
||||
#ifndef EIGERD
|
||||
#ifdef MYTHEND
|
||||
case MODULE_SERIAL_NUMBER:
|
||||
case MODULE_FIRMWARE_VERSION:
|
||||
n = receiveData(file_des,&imod,sizeof(imod),INT32);
|
||||
@ -1206,7 +1205,7 @@ int set_dac(int file_des) {
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else{
|
||||
if((ind == HV_POT) ||(ind == HV_NEW))
|
||||
retval[0] = setHighVoltage(val,imod);
|
||||
retval[0] = setHighVoltage(val);/*imod removed*/
|
||||
else if(ind == IO_DELAY)
|
||||
retval[0] = setIODelay(val,imod);
|
||||
else{
|
||||
@ -1418,7 +1417,7 @@ int write_register(int file_des) {
|
||||
addr=arg[0];
|
||||
val=arg[1];
|
||||
|
||||
#if defined(MYTHEND) || defined(GOTTHARDD)
|
||||
#ifndef EIGERD
|
||||
#ifdef VERBOSE
|
||||
printf("writing to register 0x%x data 0x%x\n", addr, val);
|
||||
#endif
|
||||
@ -1480,7 +1479,7 @@ int read_register(int file_des) {
|
||||
}
|
||||
addr=arg;
|
||||
|
||||
#if defined(MYTHEND) || defined(GOTTHARDD)
|
||||
#ifndef EIGERD
|
||||
#ifdef VERBOSE
|
||||
printf("reading register 0x%x\n", addr);
|
||||
#endif
|
||||
@ -1910,15 +1909,25 @@ int set_module(int file_des) {
|
||||
printf("eV:%d\n",myEV);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
|
||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||
switch(myModule.reg){
|
||||
case GET_SETTINGS:
|
||||
case UNINITIALIZED:
|
||||
#ifdef EIGERD
|
||||
case STANDARD:
|
||||
case HIGHGAIN:
|
||||
case LOWGAIN:
|
||||
case VERYHIGHGAIN:
|
||||
case VERYLOWGAIN:
|
||||
case UNINITIALIZED:
|
||||
#elif JUNGFRAUD
|
||||
case DYNAMICGAIN:
|
||||
case DYNAMICHG0:
|
||||
case FIXGAIN1:
|
||||
case FIXGAIN2:
|
||||
case FORCESWITCHG1:
|
||||
case FORCESWITCHG2:
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
sprintf(mess,"This setting %d does not exist for this detector\n",myModule.reg);
|
||||
@ -1927,7 +1936,6 @@ int set_module(int file_des) {
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ret==OK) {
|
||||
if (differentClients==1 && lockStatus==1) {
|
||||
ret=FAIL;
|
||||
@ -3024,7 +3032,7 @@ int set_speed(int file_des) {
|
||||
case TOT_DUTY_CYCLE:
|
||||
retval=setSpeed(arg, val);
|
||||
break;
|
||||
#elif EIGERD
|
||||
#elif defined(EIGERD) || defined(JUNGFRAU)
|
||||
case CLOCK_DIVIDER:
|
||||
retval=setSpeed(arg, val);
|
||||
break;
|
||||
@ -3175,12 +3183,12 @@ int configure_mac(int file_des) {
|
||||
|
||||
#ifndef MYTHEND
|
||||
int imod=0;//should be in future sent from client as -1, arg[2]
|
||||
int ipad;
|
||||
long long int imacadd;
|
||||
long long int idetectormacadd;
|
||||
int udpport;
|
||||
int udpport2;
|
||||
int detipad;
|
||||
uint32_t ipad;
|
||||
uint64_t imacadd;
|
||||
uint64_t idetectormacadd;
|
||||
uint32_t udpport;
|
||||
uint32_t udpport2;
|
||||
uint32_t detipad;
|
||||
#endif
|
||||
|
||||
sprintf(mess,"Can't configure MAC\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user