mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 15:50:03 +02:00
gotthard: everything done upto the gigabyte part
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@72 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
05705a907a
commit
15a649c767
@ -205,7 +205,7 @@ inet_pton(AF_INET6, "2001:db8:8714:3a90::12", &(sa.sin6_addr));
|
|||||||
// now get it back and print it
|
// now get it back and print it
|
||||||
inet_ntop(AF_INET6, &(sa.sin6_addr), str, INET6_ADDRSTRLEN);
|
inet_ntop(AF_INET6, &(sa.sin6_addr), str, INET6_ADDRSTRLEN);
|
||||||
|
|
||||||
printf("%s\n\n", str); // prints "2001:db8:8714:3a90::12"
|
//printf("%s\n\n", str); // prints "2001:db8:8714:3a90::12"
|
||||||
|
|
||||||
|
|
||||||
printf("client connected %d\n", file_des);
|
printf("client connected %d\n", file_des);
|
||||||
|
@ -943,36 +943,15 @@ int initConfGain(int val, int imod){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Setting/Getting confgain of module:%d with val:%d\n",imod,val);
|
printf("Setting/Getting confgain of module:%d with val:%d\n",imod,val);
|
||||||
#endif
|
#endif
|
||||||
volatile u_int32_t addr=GAIN_REG;
|
u_int32_t addr=GAIN_REG;
|
||||||
int writeVals[]={6,2,0,1};
|
bus_w(addr,val);
|
||||||
char cGainVal[][100]={"lower","medium","high","very high"};
|
|
||||||
|
|
||||||
//to set value
|
|
||||||
if(val!=-1){
|
|
||||||
//default value
|
|
||||||
if((val>4)||(val<1))
|
|
||||||
val=3;
|
|
||||||
//set value to converted value
|
|
||||||
bus_w(addr,writeVals[val-1]);
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Value sent is %d\n",writeVals[val-1]);
|
printf("Value sent to confGain reg is %d\n",val);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
//read value and return the converted value
|
|
||||||
val=bus_r(addr);
|
val=bus_r(addr);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Value read from reg is %d\n",val);
|
printf("Value read from confGain reg is %d\n",val);
|
||||||
#endif
|
#endif
|
||||||
switch(val){
|
|
||||||
case 6:val=1;break;
|
|
||||||
case 2:val=2;break;
|
|
||||||
case 0:val=3;break;
|
|
||||||
case 1:val=4;break;
|
|
||||||
default:printf("Weird value read:%d\n",val);return -3;break;
|
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
|
||||||
printf("Confgain of module:%d is set to %s gain of val:%d\n",imod,cGainVal[val-1],val);
|
|
||||||
#endif
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,7 +859,10 @@ int setSettings(int i)
|
|||||||
int ind;
|
int ind;
|
||||||
for (ind=0; ind<NDAC; ind++)
|
for (ind=0; ind<NDAC; ind++)
|
||||||
v[ind]=-1;
|
v[ind]=-1;
|
||||||
|
|
||||||
|
//for confGain Register
|
||||||
|
if(thisSettings!=UNDEFINED)
|
||||||
|
|
||||||
//if not get settings
|
//if not get settings
|
||||||
if ((i>=HIGHGAIN) && (i<= VERYHIGHGAIN)) {
|
if ((i>=HIGHGAIN) && (i<= VERYHIGHGAIN)) {
|
||||||
v[VREF_DS]=vrefds[i];
|
v[VREF_DS]=vrefds[i];
|
||||||
@ -1650,13 +1653,16 @@ int initModulebyNumber(sls_detector_module myMod) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
thisSettings=UNDEFINED;
|
thisSettings=UNDEFINED;
|
||||||
int modSet=setSettings(GET_SETTINGS);
|
setSettings(GET_SETTINGS);
|
||||||
printf("\n\n modSet:%d\n\n",modSet);
|
int confgain[] = CONF_GAIN;
|
||||||
//changing the confGain register
|
if ((thisSettings>=HIGHGAIN) && (thisSettings<= VERYHIGHGAIN)) {
|
||||||
//retval=initConfGainByModule(val,imod);
|
int retval=initConfGainByModule(confgain[thisSettings],imod);
|
||||||
//if(retval==-3)
|
if(retval!=confgain[thisSettings]){
|
||||||
// strcpy(mess,"Weird value read back\n");
|
printf("Weird Value read from the confGain Reg, changing settings to UNDEFINED",retval);
|
||||||
|
thisSettings=UNDEFINED;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
return myMod.reg;
|
return myMod.reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define VREFCOMP_VALS {0,0,320,420,520,620,720}
|
#define VREFCOMP_VALS {0,0,320,420,520,620,720}
|
||||||
#define IBTESTC_VALS {0,0,340,440,540,640,740}
|
#define IBTESTC_VALS {0,0,340,440,540,640,740}
|
||||||
#define CONF_GAIN {0,0, 0, 1, 6, 2, 1}//dynamic gain confgain yet to be figured out
|
#define CONF_GAIN {0,0, 0, 1, 6, 2, 1}//dynamic gain confgain yet to be figured out
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULTGAIN {11.66,9.32,14.99}
|
#define DEFAULTGAIN {11.66,9.32,14.99}
|
||||||
#define DEFAULTOFFSET {817.5,828.6,804.2}
|
#define DEFAULTOFFSET {817.5,828.6,804.2}
|
||||||
|
@ -1320,7 +1320,10 @@ int set_module(int fnum) {
|
|||||||
if (ret==OK) {
|
if (ret==OK) {
|
||||||
#ifdef MCB_FUNCS
|
#ifdef MCB_FUNCS
|
||||||
retval=initModulebyNumber(myModule);
|
retval=initModulebyNumber(myModule);
|
||||||
|
if(retval==-1){
|
||||||
|
ret=FAIL;
|
||||||
|
strcpy(mess,"Cannot set this settings as confGain register read back weird value\n");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user