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:
l_maliakal_d 2011-11-28 17:08:03 +00:00
parent 05705a907a
commit 15a649c767
5 changed files with 24 additions and 36 deletions

View File

@ -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);

View File

@ -943,35 +943,14 @@ 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
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 #endif
return val; return val;
} }

View File

@ -860,6 +860,9 @@ int setSettings(int i)
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;
} }

View File

@ -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
} }